aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/InkStrokeProperties.ts
diff options
context:
space:
mode:
authorvkalev <vjk1883@gmail.com>2021-07-06 14:27:29 -0500
committervkalev <vjk1883@gmail.com>2021-07-06 14:27:29 -0500
commit5ab81f49a11bd8a74725228a887a90c88a3848ff (patch)
treeb04396026c765c6e216988927b71570497286ecf /src/client/views/InkStrokeProperties.ts
parenta0207bf861908da9235a1752a723e69ecdbba734 (diff)
added breaking of tangent handle lines by holding 'Alt' key when moving
Diffstat (limited to 'src/client/views/InkStrokeProperties.ts')
-rw-r--r--src/client/views/InkStrokeProperties.ts6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/client/views/InkStrokeProperties.ts b/src/client/views/InkStrokeProperties.ts
index a5c028730..812e8ff6e 100644
--- a/src/client/views/InkStrokeProperties.ts
+++ b/src/client/views/InkStrokeProperties.ts
@@ -220,15 +220,15 @@ export class InkStrokeProperties {
*/
@undoBatch
@action
- moveHandle = (deltaX: number, deltaY: number, handleIndex: number) =>
+ moveHandle = (deltaX: number, deltaY: number, handleIndex: number, brokenIndices: number[]) =>
this.applyFunction((doc: Doc, ink: InkData, xScale: number, yScale: number) => {
const order = handleIndex % 4;
const oldHandlePoint = ink[handleIndex];
const newHandlePoint = { X: ink[handleIndex].X - deltaX / xScale, Y: ink[handleIndex].Y - deltaY / yScale };
ink[handleIndex] = newHandlePoint;
- // Rotating opposite handle (first and final control point only have one handle).
- if (handleIndex !== 1 && handleIndex !== ink.length - 2) {
+ // Rotate opposite handle if user hasn't held 'Alt' key or not first/final control (which have only 1 handle).
+ if (!brokenIndices.includes(handleIndex) && handleIndex !== 1 && handleIndex !== ink.length - 2) {
let oppositeHandlePoint = order === 1 ? ink[handleIndex - 3] : ink[handleIndex + 3];
const controlPoint = order === 1 ? ink[handleIndex - 1] : ink[handleIndex + 1];
const angle = this.angleChange(oldHandlePoint, newHandlePoint, controlPoint);