Skip to content

Commit

Permalink
Merge pull request #12556 from quillblue/master
Browse files Browse the repository at this point in the history
fix(axisLabel): fix axisLabel rotating with grid.containLabel #12259
  • Loading branch information
pissang committed Aug 4, 2020
2 parents b9fc3f9 + 0278323 commit 38bd9eb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/coord/axisHelper.js
Expand Up @@ -387,8 +387,8 @@ function rotateTextRect(textRect, rotate) {
var boundingBox = textRect.plain();
var beforeWidth = boundingBox.width;
var beforeHeight = boundingBox.height;
var afterWidth = beforeWidth * Math.cos(rotateRadians) + beforeHeight * Math.sin(rotateRadians);
var afterHeight = beforeWidth * Math.sin(rotateRadians) + beforeHeight * Math.cos(rotateRadians);
var afterWidth = beforeWidth * Math.abs(Math.cos(rotateRadians)) + Math.abs(beforeHeight * Math.sin(rotateRadians));
var afterHeight = beforeWidth * Math.abs(Math.sin(rotateRadians)) + Math.abs(beforeHeight * Math.cos(rotateRadians));
var rotatedRect = new BoundingRect(boundingBox.x, boundingBox.y, afterWidth, afterHeight);

return rotatedRect;
Expand Down
11 changes: 9 additions & 2 deletions test/axisLabel.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 38bd9eb

Please sign in to comment.