diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx index 4654de427..23fa227c2 100644 --- a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx +++ b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx @@ -751,15 +751,10 @@ export class CollectionFreeFormView extends CollectionSubView<Partial<collection // create a new curve by appending all curves of the current segment together in order to render a single new stroke. if (Doc.ActiveTool !== InkTool.StrokeEraser) { this._eraserLock++; - var segments; - if (Doc.ActiveTool === InkTool.SegmentEraser) { - segments = this.segmentErase(intersect.inkView, intersect.t); // intersect.t is where the eraser intersected the ink stroke - want to remove the segment that starts at the intersection just before this t value and goes to the one just after it - } else if (Doc.ActiveTool === InkTool.RadiusEraser) { - const inkCoords = intersect.inkView.ComponentView?.ptFromScreen?.(currPoint); // coordinates in ink space - if (inkCoords !== undefined) { - segments = this.radiusErase(intersect.inkView, intersect.t, inkCoords); - } - } + const segments = + Doc.ActiveTool === InkTool.SegmentEraser + ? this.segmentErase(intersect.inkView, intersect.t) // intersect.t is where the eraser intersected the ink stroke - want to remove the segment that starts at the intersection just before this t value and goes to the one just after it + : this.radiusErase(intersect.inkView, intersect.t, currPoint); // } else if (Doc.ActiveTool === InkTool.RadiusEraser) { // segments = undefined; // } @@ -841,8 +836,11 @@ export class CollectionFreeFormView extends CollectionSubView<Partial<collection }; @action - radiusErase = (ink: DocumentView, eraseT: number, inkCoords: { X: number; Y: number }): Segment[] => { + radiusErase = (ink: DocumentView, eraseT: number, screenEraserPt: { X: number; Y: number }): Segment[] => { const segments: Segment[] = []; + const inkCoords = ink.ComponentView?.ptFromScreen?.(screenEraserPt); // coordinates in ink space + if (!inkCoords) return []; + var segment1: Segment = []; var segment2: Segment = []; const eraseRadius = ActiveInkWidth() / 2; |