From 8176b94970b86bd3c1669130f6fef2ccd70d0b84 Mon Sep 17 00:00:00 2001 From: vkalev Date: Thu, 9 Dec 2021 17:40:21 -0500 Subject: changing cursor + adding entire ink deletion mode when 'Alt' is pressed --- .../collectionFreeForm/CollectionFreeFormView.tsx | 19 +++++++++++-------- .../collections/collectionFreeForm/MarqueeView.tsx | 3 ++- 2 files changed, 13 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx index df690da49..bb1d560d6 100644 --- a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx +++ b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx @@ -646,7 +646,7 @@ export class CollectionFreeFormView extends CollectionSubView { + eraseInkStrokes = (e: PointerEvent, eraserIntersections: Intersection[]) => { eraserIntersections.forEach(intersect => { const ink = intersect.ink; if (ink && !this._deleteList.includes(ink)) { this._deleteList.push(ink); SetActiveInkWidth(StrCast(ink.rootDoc.strokeWidth?.toString()) || "1"); SetActiveInkColor(StrCast(ink.rootDoc.color?.toString()) || "black"); - // create a new curve by appending all curves of the current segment together in order to render a single new stroke. - this.segmentInkStroke(ink, intersect.t ?? 0).forEach(segment => - GestureOverlay.Instance.dispatchGesture(GestureUtils.Gestures.Stroke, - segment.reduce((data, curve) => [...data, ...curve.points - .map(p => ink.ComponentView?.ptToScreen?.({ X: p.x, Y: p.y }) ?? { X: 0, Y: 0 }) - ], [] as PointData[]))); + // Piecewise ink deletion mode if the 'Alt' is not held down. + if (!e.altKey) { + // create a new curve by appending all curves of the current segment together in order to render a single new stroke. + this.segmentInkStroke(ink, intersect.t ?? 0).forEach(segment => + GestureOverlay.Instance.dispatchGesture(GestureUtils.Gestures.Stroke, + segment.reduce((data, curve) => [...data, ...curve.points + .map(p => ink.ComponentView?.ptToScreen?.({ X: p.x, Y: p.y }) ?? { X: 0, Y: 0 }) + ], [] as PointData[]))); + } // Lower ink opacity to give the user a visual indicator of deletion. ink.layoutDoc.opacity = 0.5; } diff --git a/src/client/views/collections/collectionFreeForm/MarqueeView.tsx b/src/client/views/collections/collectionFreeForm/MarqueeView.tsx index 24a7d77e0..08da682bb 100644 --- a/src/client/views/collections/collectionFreeForm/MarqueeView.tsx +++ b/src/client/views/collections/collectionFreeForm/MarqueeView.tsx @@ -647,8 +647,9 @@ export class MarqueeView extends React.Component e.preventDefault()} onScroll={(e) => e.currentTarget.scrollTop = e.currentTarget.scrollLeft = 0} onClick={this.onClick} onPointerDown={this.onPointerDown}> {this._visible ? this.marqueeDiv : null} -- cgit v1.2.3-70-g09d2