aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx
diff options
context:
space:
mode:
authorJoanne <zehan_ding@brown.edu>2025-06-24 10:15:04 -0400
committerJoanne <zehan_ding@brown.edu>2025-06-24 10:15:04 -0400
commitad1f2ffb01fef49449c2dd5875659e1c904558fd (patch)
tree3c586cc104b18b9bc183ebf875c970292aae06ca /src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx
parent17ec2a19b2d2dc5ba3f99c43d86c27946de2ac71 (diff)
parent1396850b90ed2dcca3776057ec4a7f2fc7ff297a (diff)
Merge branch 'master' of https://github.com/brown-dash/Dash-Web into joanne-tutorialagent
Diffstat (limited to 'src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx')
-rw-r--r--src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx53
1 files changed, 31 insertions, 22 deletions
diff --git a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx
index 8f9b132e8..a447a6ae4 100644
--- a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx
+++ b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx
@@ -564,7 +564,7 @@ export class CollectionFreeFormView extends CollectionSubView<Partial<collection
const B = this.screenToFreeformContentsXf.transformBounds(ge.bounds.left, ge.bounds.top, ge.bounds.width, ge.bounds.height);
const inkDoc = this.createInkDoc(points, B);
if (Doc.ActiveInk === InkInkTool.Highlight) inkDoc.$backgroundColor = 'transparent';
- if (Doc.ActiveInk === InkInkTool.Write) {
+ if ([InkInkTool.Write, InkInkTool.Math].includes(Doc.ActiveInk)) {
this.unprocessedDocs.push(inkDoc);
CollectionFreeFormView.collectionsWithUnprocessedInk.add(this);
}
@@ -2260,18 +2260,41 @@ export class CollectionFreeFormView extends CollectionSubView<Partial<collection
);
};
+ @computed get inkEraser() {
+ return (
+ Doc.ActiveTool === InkTool.Eraser &&
+ Doc.ActiveEraser === InkEraserTool.Radius &&
+ this._showEraserCircle && (
+ <div
+ onPointerMove={this.onCursorMove}
+ style={{
+ position: 'fixed',
+ left: this._eraserX,
+ top: this._eraserY,
+ width: (ActiveEraserWidth() + 5) * 2,
+ height: (ActiveEraserWidth() + 5) * 2,
+ borderRadius: '50%',
+ border: '1px solid gray',
+ transform: 'translate(-50%, -50%)',
+ }}
+ />
+ )
+ );
+ }
+
+ setRef = (r: HTMLDivElement | null) => {
+ this.createDashEventsTarget(r);
+ this.fixWheelEvents(r, this._props.isContentActive, this.onPassiveWheel);
+ r?.addEventListener('mouseleave', this.onMouseLeave);
+ r?.addEventListener('mouseenter', this.onMouseEnter);
+ };
render() {
TraceMobx();
return (
<div
className="collectionfreeformview-container"
id={this._paintedId}
- ref={r => {
- this.createDashEventsTarget(r);
- this.fixWheelEvents(r, this._props.isContentActive, this.onPassiveWheel);
- r?.addEventListener('mouseleave', this.onMouseLeave);
- r?.addEventListener('mouseenter', this.onMouseEnter);
- }}
+ ref={this.setRef}
onWheel={this.onPointerWheel}
onClick={this.onClick}
onPointerDown={this.onPointerDown}
@@ -2286,21 +2309,7 @@ export class CollectionFreeFormView extends CollectionSubView<Partial<collection
width: `${100 / this.nativeDimScaling}%`,
height: this._props.getScrollHeight?.() ?? `${100 / this.nativeDimScaling}%`,
}}>
- {Doc.ActiveTool === InkTool.Eraser && Doc.ActiveEraser === InkEraserTool.Radius && this._showEraserCircle && (
- <div
- onPointerMove={this.onCursorMove}
- style={{
- position: 'fixed',
- left: this._eraserX,
- top: this._eraserY,
- width: (ActiveEraserWidth() + 5) * 2,
- height: (ActiveEraserWidth() + 5) * 2,
- borderRadius: '50%',
- border: '1px solid gray',
- transform: 'translate(-50%, -50%)',
- }}
- />
- )}
+ {this.inkEraser}
{this.paintFunc ? (
<FormattedTextBox {...this.props} /> // need this so that any live dashfieldviews will update the underlying text that the code eval reads
) : this._lightboxDoc ? (