aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx33
1 files changed, 29 insertions, 4 deletions
diff --git a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx
index ca9a9974a..622189b80 100644
--- a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx
+++ b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx
@@ -95,6 +95,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;
@@ -739,6 +741,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 };
@@ -783,6 +786,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));
@@ -1035,16 +1040,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;
}
@@ -1090,6 +1097,9 @@ export class CollectionFreeFormView extends CollectionSubView<Partial<collection
}
segments.push(currSegment);
}
+ if (segments.length === 0) {
+ console.log("segments is 0");
+ }
return segments;
};
@@ -1988,6 +1998,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));
};
@@ -2274,6 +2286,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 ? (