mirror of
https://github.com/scratchfoundation/scratch-paint.git
synced 2025-01-10 14:42:13 -05:00
Switch fix aspect ratio to default when resizing by a corner (#681)
This commit is contained in:
parent
4b658c294f
commit
b6ad997ea2
1 changed files with 13 additions and 1 deletions
|
@ -40,6 +40,7 @@ class ScaleTool {
|
|||
this.corner = boundsPath.bounds[this._getRectCornerNameByIndex(index)].clone();
|
||||
this.origSize = this.corner.subtract(this.pivot);
|
||||
this.origCenter = boundsPath.bounds.center;
|
||||
this.isCorner = this._isCorner(index);
|
||||
this.centered = false;
|
||||
this.lastSx = 1;
|
||||
this.lastSy = 1;
|
||||
|
@ -105,7 +106,7 @@ class ScaleTool {
|
|||
sy = size.y / modOrigSize.y;
|
||||
}
|
||||
|
||||
if (event.modifiers.shift) {
|
||||
if (this.isCorner && !event.modifiers.shift) {
|
||||
const signx = sx > 0 ? 1 : -1;
|
||||
const signy = sy > 0 ? 1 : -1;
|
||||
sx = sy = Math.max(Math.abs(sx), Math.abs(sy));
|
||||
|
@ -197,6 +198,17 @@ class ScaleTool {
|
|||
return 'topCenter';
|
||||
}
|
||||
}
|
||||
_isCorner (index) {
|
||||
switch (index) {
|
||||
case 0:
|
||||
case 2:
|
||||
case 4:
|
||||
case 6:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default ScaleTool;
|
||||
|
|
Loading…
Reference in a new issue