Skip to content

Commit

Permalink
delta calculation simplified
Browse files Browse the repository at this point in the history
  • Loading branch information
kleber-swf committed Dec 4, 2021
1 parent ebdb1df commit d80f5b3
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions src/editor-view/selectors/handlers/scale.handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,16 +100,9 @@ export class ScaleHandler implements DraggingHandler {
const lastPoint = this._point;
const newPoint = SelectionUtil.mouseEventToGamePoint(e, { x: 0, y: 0 });

let dx = 0;
if (this._hside === HSide.Left) dx = lastPoint.x - newPoint.x;
else if (this._hside === HSide.Right) dx = newPoint.x - lastPoint.x;
const dx = (lastPoint.x - newPoint.x) * Math.sign(this._hside - 0.5);
const dy = (lastPoint.y - newPoint.y) * Math.sign(this._vside - 0.5);

let dy = 0;
if (this._vside === VSide.Top) dy = lastPoint.y - newPoint.y;
else if (this._vside === VSide.Bottom) dy = newPoint.y - lastPoint.y;

// const dy = (lastPoint.y - newPoint.y) * Math.sign(this._vside - 0.5);
// const dx = (lastPoint.x - newPoint.x) * Math.sign(this._hside - 0.5);
this._point = newPoint;

const obj = this._object;
Expand Down

0 comments on commit d80f5b3

Please sign in to comment.