diff options
author | vkalev <vjk1883@gmail.com> | 2021-09-28 15:24:42 -0400 |
---|---|---|
committer | vkalev <vjk1883@gmail.com> | 2021-09-28 15:24:42 -0400 |
commit | 2de1f44d00bcaa5e95045d8b6b7a2c713a72e7b3 (patch) | |
tree | 014863b5bbed60b6fe8f16675a4368d853da122a | |
parent | e4a0d2c5752f541926d1fa6b36a284b9b3d69af9 (diff) |
updating broken indices
-rw-r--r-- | src/client/views/InkStrokeProperties.ts | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/src/client/views/InkStrokeProperties.ts b/src/client/views/InkStrokeProperties.ts index 6b4cf9e50..adb9a7aa1 100644 --- a/src/client/views/InkStrokeProperties.ts +++ b/src/client/views/InkStrokeProperties.ts @@ -82,6 +82,21 @@ export class InkStrokeProperties { const array = [{ x: controls[i].X, y: controls[i].Y }, { x: controls[i + 1].X, y: controls[i + 1].Y }, { x: controls[i + 2].X, y: controls[i + 2].Y }, { x: controls[i + 3].X, y: controls[i + 3].Y }]; const newsegs = new Bezier(array).split(t); controls.splice(i, 4, ...[...newsegs.left.points.map(p => ({ X: p.x, Y: p.y })), ...newsegs.right.points.map(p => ({ X: p.x, Y: p.y }))]); + + let brokenIndices = Cast(doc.brokenInkIndices, listSpec("number")); + // Updating the indices of the control points whose handle tangency has been broken. + if (brokenIndices) { + brokenIndices = new List(brokenIndices.map((control) => { + if (control >= i) { + return control + 4; + } else { + return control; + } + })); + } + doc.brokenInkIndices = brokenIndices; + this._currentPoint = -1; + return controls; }); // this.applyFunction((doc: Doc, ink: InkData) => { @@ -124,19 +139,7 @@ export class InkStrokeProperties { // } // } - // let brokenIndices = Cast(doc.brokenInkIndices, listSpec("number")); - // // Updating the indices of the control points whose handle tangency has been broken. - // if (brokenIndices) { - // brokenIndices = new List(brokenIndices.map((control) => { - // if (control >= newIndex) { - // return control + 4; - // } else { - // return control; - // } - // })); - // } - // doc.brokenInkIndices = brokenIndices; - // this._currentPoint = -1; + // return newPoints; // }); } |