diff options
author | bobzel <zzzman@gmail.com> | 2024-09-06 09:55:59 -0400 |
---|---|---|
committer | bobzel <zzzman@gmail.com> | 2024-09-06 09:55:59 -0400 |
commit | ce6dc55b39d67467f9ea1e88382a6c74f060b660 (patch) | |
tree | d70f7f0db4d3048ebdaae080e02a1fdeafa5df13 /src | |
parent | e2dddcb929f5f36e34e73b0e02205e0177f87645 (diff) |
fixed scribbleErase crash on non-ink strokes.
Diffstat (limited to 'src')
-rw-r--r-- | src/client/views/GestureOverlay.tsx | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/src/client/views/GestureOverlay.tsx b/src/client/views/GestureOverlay.tsx index c1ac3ab06..4185050d2 100644 --- a/src/client/views/GestureOverlay.tsx +++ b/src/client/views/GestureOverlay.tsx @@ -154,19 +154,21 @@ export class GestureOverlay extends ObservableReactComponent<React.PropsWithChil const point3 = cuspArray[i + 2]; const triangleObject = { p1: { X: point1.X, Y: point1.Y }, p2: { X: point2.X, Y: point2.Y }, p3: { X: point3.X, Y: point3.Y } }; const otherInk = DocumentView.getDocumentView(doc)?.ComponentView as InkingStroke; - const { inkData: otherInkData } = otherInk?.inkScaledData() ?? { inkData: [] }; - const otherScreenPts = otherInkData.map(point => otherInk.ptToScreen(point)); - if (doc.title === 'line') { - if (this.doesLineIntersectTriangle(otherScreenPts, triangleObject)) { - docsToDelete.push(doc); - hasDocInTriangle = true; - cuspBooleanArray.push(true); - } - } else { - if (this.isAnyPointInTriangle(triangleObject, otherScreenPts)) { - docsToDelete.push(doc); - hasDocInTriangle = true; - cuspBooleanArray.push(true); + if (otherInk instanceof InkingStroke) { + const { inkData: otherInkData } = otherInk?.inkScaledData() ?? { inkData: [] }; + const otherScreenPts = otherInkData.map(point => otherInk.ptToScreen(point)); + if (doc.title === 'line') { + if (this.doesLineIntersectTriangle(otherScreenPts, triangleObject)) { + docsToDelete.push(doc); + hasDocInTriangle = true; + cuspBooleanArray.push(true); + } + } else { + if (this.isAnyPointInTriangle(triangleObject, otherScreenPts)) { + docsToDelete.push(doc); + hasDocInTriangle = true; + cuspBooleanArray.push(true); + } } } } |