diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/client/views/InkStrokeProperties.ts | 3 | ||||
-rw-r--r-- | src/client/views/InkingStroke.tsx | 6 |
2 files changed, 6 insertions, 3 deletions
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<FieldViewProps, InkDocume this._controlUndo = undefined; } @action - delPts = (e: KeyboardEvent | React.PointerEvent | undefined) => { - 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(); } } |