-
Notifications
You must be signed in to change notification settings - Fork 652
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #725 from benvirus/bugfix/label-rotate-padding-error
fix: 修复Shape.Text 在设置 rotate 之后 Box 宽高不正确的问题
- Loading branch information
Showing
3 changed files
with
47 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
const Rect = { | ||
calcRotatedBox({ width, height, rotate }) { | ||
const absRotate = Math.abs(rotate); | ||
return { | ||
width: Math.abs(width * Math.cos(absRotate) + height * Math.sin(absRotate)), | ||
height: Math.abs(height * Math.cos(absRotate) + width * Math.sin(absRotate)) | ||
}; | ||
} | ||
}; | ||
|
||
module.exports = Rect; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters