mirror of
https://github.com/scratchfoundation/scratch-paint.git
synced 2025-03-23 03:15:55 -04:00
Set the rotation center of bitmaps with no rotation center to the center of the stage
This commit is contained in:
parent
87e01639c0
commit
8b03c5af54
1 changed files with 7 additions and 0 deletions
|
@ -148,6 +148,13 @@ class PaperCanvas extends React.Component {
|
||||||
if (!this.queuedImageToLoad) return;
|
if (!this.queuedImageToLoad) return;
|
||||||
this.queuedImageToLoad = null;
|
this.queuedImageToLoad = null;
|
||||||
|
|
||||||
|
if (typeof rotationCenterX === 'undefined') {
|
||||||
|
rotationCenterX = imgElement.width / 2;
|
||||||
|
}
|
||||||
|
if (typeof rotationCenterY === 'undefined') {
|
||||||
|
rotationCenterY = imgElement.height / 2;
|
||||||
|
}
|
||||||
|
|
||||||
getRaster().drawImage(
|
getRaster().drawImage(
|
||||||
imgElement,
|
imgElement,
|
||||||
(ART_BOARD_WIDTH / 2) - rotationCenterX,
|
(ART_BOARD_WIDTH / 2) - rotationCenterX,
|
||||||
|
|
Loading…
Reference in a new issue