Skip to content

Commit f5cb133

Browse files
authored
fix: label text not centered when applied rotation (#10773)
* fix: label text not centered on tick when rotated #10485 * fix: label text not centered on tick when rotated #10485
1 parent 3ecda1c commit f5cb133

19 files changed

+33
-0
lines changed

src/core/core.scale.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1241,6 +1241,9 @@ export default class Scale extends Element {
12411241
if (mirror) {
12421242
textOffset *= -1;
12431243
}
1244+
if (rotation !== 0 && !optsAtIndex.showLabelBackdrop) {
1245+
x += (lineHeight / 2) * Math.sin(rotation);
1246+
}
12441247
} else {
12451248
y = pixel;
12461249
textOffset = (1 - lineCount) * lineHeight / 2;
5 Bytes
Loading
41 Bytes
Loading
-8 Bytes
Loading
-50 Bytes
Loading
266 Bytes
Loading
-44 Bytes
Loading
13 Bytes
Loading
-79 Bytes
Loading
53 Bytes
Loading

0 commit comments

Comments
 (0)