diff options
Diffstat (limited to 'src/client/views/InkControlPtHandles.tsx')
-rw-r--r-- | src/client/views/InkControlPtHandles.tsx | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/client/views/InkControlPtHandles.tsx b/src/client/views/InkControlPtHandles.tsx index 76ce73b0d..0996e75d4 100644 --- a/src/client/views/InkControlPtHandles.tsx +++ b/src/client/views/InkControlPtHandles.tsx @@ -191,16 +191,16 @@ export class InkEndPtHandles extends React.Component<InkEndProps> { setupMoveUpEvents(this, e, (e) => { if (!this.controlUndo) this.controlUndo = UndoManager.StartBatch("stretch ink"); // compute stretch factor by finding scaling along axis between start and end points - const v1 = { x: p1().X - p2().X, y: p1().Y - p2().Y }; - const v2 = { x: e.clientX - p2().X, y: e.clientY - p2().Y }; - const v1len = Math.sqrt(v1.x * v1.x + v1.y * v1.y); - const v2len = Math.sqrt(v2.x * v2.x + v2.y * v2.y); + const v1 = { X: p1().X - p2().X, Y: p1().Y - p2().Y }; + const v2 = { X: e.clientX - p2().X, Y: e.clientY - p2().Y }; + const v1len = Math.sqrt(v1.X * v1.X + v1.Y * v1.Y); + const v2len = Math.sqrt(v2.X * v2.X + v2.Y * v2.Y); const scaling = v2len / v1len; - const v1n = { x: v1.x / v1len, y: v1.y / v1len }; - const v2n = { x: v2.x / v2len, y: v2.y / v2len }; - const angle = Math.acos(v1n.x * v2n.x + v1n.y * v2n.y) * Math.sign(v1.x * v2.y - v2.x * v1.y); - InkStrokeProperties.Instance.stretchInk([this.props.inkView], scaling, { x: p2().X, y: p2().Y }, v1n); - InkStrokeProperties.Instance.rotateInk([this.props.inkView], angle, { x: p2().X, y: p2().Y }); + const v1n = { X: v1.X / v1len, Y: v1.Y / v1len }; + const v2n = { X: v2.X / v2len, Y: v2.Y / v2len }; + const angle = Math.acos(v1n.X * v2n.X + v1n.Y * v2n.Y) * Math.sign(v1.X * v2.Y - v2.X * v1.Y); + InkStrokeProperties.Instance.stretchInk([this.props.inkView], scaling, p2(), v1n, e.shiftKey); + InkStrokeProperties.Instance.rotateInk([this.props.inkView], angle, p2()); return false; }, action(() => { this.controlUndo?.end(); |