Skip to content

Commit

Permalink
Fix scale equally and double flip not happening (#4313)
Browse files Browse the repository at this point in the history
* fix double flip

* fixed lint
  • Loading branch information
asturur committed Sep 16, 2017
1 parent f85e3dd commit 7baec03
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/canvas.class.js
Original file line number Diff line number Diff line change
Expand Up @@ -868,12 +868,13 @@
var dist = localMouse.y + localMouse.x,
lastDist = _dim.y * transform.original.scaleY / target.scaleY +
_dim.x * transform.original.scaleX / target.scaleX,
scaled;
scaled, signX = localMouse.x / Math.abs(localMouse.x),
signY = localMouse.y / Math.abs(localMouse.y);

// We use transform.scaleX/Y instead of target.scaleX/Y
// because the object may have a min scale and we'll loose the proportions
transform.newScaleX = transform.original.scaleX * dist / lastDist;
transform.newScaleY = transform.original.scaleY * dist / lastDist;
transform.newScaleX = signX * Math.abs(transform.original.scaleX * dist / lastDist);
transform.newScaleY = signY * Math.abs(transform.original.scaleY * dist / lastDist);
scaled = transform.newScaleX !== target.scaleX || transform.newScaleY !== target.scaleY;
target.set('scaleX', transform.newScaleX);
target.set('scaleY', transform.newScaleY);
Expand Down

0 comments on commit 7baec03

Please sign in to comment.