From 47006b0025ae9ea13313900124ca097227be50a2 Mon Sep 17 00:00:00 2001 From: bobzel Date: Sat, 8 May 2021 11:33:20 -0400 Subject: fixed deleting ink stroke points. --- src/client/views/InkStrokeProperties.ts | 3 +++ src/client/views/InkingStroke.tsx | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/client/views/InkStrokeProperties.ts b/src/client/views/InkStrokeProperties.ts index 358cce35b..5cbfa65cd 100644 --- a/src/client/views/InkStrokeProperties.ts +++ b/src/client/views/InkStrokeProperties.ts @@ -117,6 +117,7 @@ export class InkStrokeProperties { @undoBatch @action deletePoints = () => { + var deleted = false; this.selectedInk?.forEach(action(inkView => { if (this.selectedInk?.length === 1 && this._currPoint !== -1) { const doc = Document(inkView.rootDoc); @@ -141,10 +142,12 @@ export class InkStrokeProperties { Doc.GetProto(doc).data = new InkField(newerPoints); } + deleted = true; } } } })); + return deleted; } @undoBatch diff --git a/src/client/views/InkingStroke.tsx b/src/client/views/InkingStroke.tsx index 966abc0e7..b97d09fda 100644 --- a/src/client/views/InkingStroke.tsx +++ b/src/client/views/InkingStroke.tsx @@ -81,9 +81,9 @@ export class InkingStroke extends ViewBoxBaseComponent { - if (InkStrokeProperties.Instance && (e instanceof KeyboardEvent ? e.key === "-" : true)) { - InkStrokeProperties.Instance.deletePoints(); + delPts = (e: KeyboardEvent) => { + if (["-", "Backspace", "Delete"].includes(e.key)) { + if (InkStrokeProperties.Instance?.deletePoints()) e.stopPropagation(); } } -- cgit v1.2.3-70-g09d2