diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx | 35 |
1 files changed, 29 insertions, 6 deletions
diff --git a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx index 2e174be30..ab47c105e 100644 --- a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx +++ b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx @@ -97,6 +97,8 @@ export class CollectionFreeFormView extends CollectionSubView<Partial<collection private _panZoomTransitionTimer: any; private _lastX: number = 0; private _lastY: number = 0; + @observable _eraserX: number = 0; + @observable _eraserY: number = 0; private _downX: number = 0; private _downY: number = 0; private _downTime = 0; @@ -741,6 +743,7 @@ export class CollectionFreeFormView extends CollectionSubView<Partial<collection * By default this iterates through all intersected ink strokes, determines their segmentation, draws back the non-intersected segments, * and deletes the original stroke. */ + @action onEraserMove = (e: PointerEvent, down: number[], delta: number[]) => { const currPoint = { X: e.clientX, Y: e.clientY }; @@ -775,6 +778,8 @@ export class CollectionFreeFormView extends CollectionSubView<Partial<collection @action onRadiusEraserMove = (e: PointerEvent, down: number[], delta: number[]) => { + // this._eraserX = e.clientX; + // this._eraserY = e.clientY; const currPoint = { X: e.clientX, Y: e.clientY }; this._eraserPts.push([currPoint.X, currPoint.Y]); this._eraserPts = this._eraserPts.slice(Math.max(0, this._eraserPts.length - 5)); @@ -964,7 +969,6 @@ export class CollectionFreeFormView extends CollectionSubView<Partial<collection eraserMax.X >= inkViewBounds.left && eraserMax.Y >= inkViewBounds.top ); - console.log("itersectnig strokes", intersectingStrokes); intersectingStrokes.forEach(({ inkStroke, inkView }) => { const { inkData } = inkStroke.inkScaledData(); const prevPointInkSpace = inkStroke.ptFromScreen(lastPoint); @@ -1007,7 +1011,6 @@ export class CollectionFreeFormView extends CollectionSubView<Partial<collection } } }); - console.log("strokeToTVals", strokeToTVals); return strokeToTVals; }; @@ -1028,16 +1031,18 @@ export class CollectionFreeFormView extends CollectionSubView<Partial<collection for (var i = 0; i < inkData.length - 3; i +=4) { currSegment.push(InkField.Segment(inkData, i)); } - if (currSegment.length > 0) { - segments.push(currSegment); - return segments; - } + segments.push(currSegment); + return segments; } var continueErasing = false; var firstSegment: Segment = []; // early return if nothing to split on if (tVals.length === 0 || (tVals.length === 1 && tVals[0] === 0)) { + for (var i = 0; i < inkData.length - 3; i += 4) { + currSegment.push(InkField.Segment(inkData, i)); + } + segments.push(currSegment); return segments; } @@ -1082,6 +1087,9 @@ export class CollectionFreeFormView extends CollectionSubView<Partial<collection } segments.push(currSegment); } + if (segments.length === 0) { + console.log("segments is 0"); + } return segments; }; @@ -1980,6 +1988,8 @@ export class CollectionFreeFormView extends CollectionSubView<Partial<collection @action onCursorMove = (e: React.PointerEvent) => { + this._eraserX = e.clientX; + this._eraserY = e.clientY; // super.setCursorPosition(this.getTransform().transformPoint(e.clientX, e.clientY)); }; @@ -2265,6 +2275,19 @@ export class CollectionFreeFormView extends CollectionSubView<Partial<collection width: `${100 / (this.nativeDimScaling || 1)}%`, height: this._props.getScrollHeight?.() ?? `${100 / (this.nativeDimScaling || 1)}%`, }}> + {/* <div + onPointerMove={this.onCursorMove} + style={{ + position: 'fixed', + left: this._eraserX, + top: this._eraserY, + width: '30px', + height: '30px', + borderRadius: '50%', + // backgroundColor: 'transparent', + border: '1px solid black', + }} + /> */} {this.paintFunc ? ( <FormattedTextBox {...this.props} /> // need this so that any live dashfieldviews will update the underlying text that the code eval reads ) : this._lightboxDoc ? ( |