aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2021-09-28 15:06:25 -0400
committerbobzel <zzzman@gmail.com>2021-09-28 15:06:25 -0400
commite4a0d2c5752f541926d1fa6b36a284b9b3d69af9 (patch)
treec24aef500b125c0a73c01762601e34479116e804 /src
parent84ebdbe652fb38fb16a02c294739b5a26365d12b (diff)
added the splice
Diffstat (limited to 'src')
-rw-r--r--src/client/views/InkStrokeProperties.ts8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/client/views/InkStrokeProperties.ts b/src/client/views/InkStrokeProperties.ts
index 03946bb60..6b4cf9e50 100644
--- a/src/client/views/InkStrokeProperties.ts
+++ b/src/client/views/InkStrokeProperties.ts
@@ -78,8 +78,12 @@ export class InkStrokeProperties {
@undoBatch
@action
addPoints = (t: number, i: number, controls: { X: number, Y: number }[]) => {
- 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);
+ this.applyFunction((doc: Doc, ink: InkData) => {
+ 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 }))]);
+ return controls;
+ });
// this.applyFunction((doc: Doc, ink: InkData) => {
// const newControl = { X: x, Y: y };
// const newPoints: InkData = [];