Skip to content

Commit

Permalink
updated label height calc
Browse files Browse the repository at this point in the history
  • Loading branch information
jongund committed Nov 15, 2023
1 parent 46cb2bb commit 240c65c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 2 additions & 0 deletions content/patterns/slider/examples/css/slider-rating.css
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,13 @@

.rating-slider svg .label {
font-size: 90%;
font-family: sans-serif;
fill: currentcolor;
}

.rating-slider svg .description {
font-size: 90%;
font-family: sans-serif;
fill: canvasText;
}

Expand Down
7 changes: 5 additions & 2 deletions content/patterns/slider/examples/js/slider-rating.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,11 @@ class RatingSlider {
rect.setAttribute('height', RAIL_HEIGHT);
rect.removeAttribute('rx');

const labelWidth = label.getBBox().width;
const labelHeight = label.getBBox().height;
const labelWidth = Math.round(label.getBBox().width);
const labelHeight = Math.round(label.getBBox().height);

label.setAttribute('data-width', labelWidth);
label.setAttribute('data-height', labelHeight);

label.setAttribute(
'x',
Expand Down

0 comments on commit 240c65c

Please sign in to comment.