diff options
| author | eleanor-park <eleanor_park@brown.edu> | 2024-07-23 12:07:53 -0400 |
|---|---|---|
| committer | eleanor-park <eleanor_park@brown.edu> | 2024-07-23 12:07:53 -0400 |
| commit | 3e1ef3d0b5445065ab3f44ffc17bbb04efaa8c8a (patch) | |
| tree | 54060710007bb52986e86efba0162ffef9142229 /src/client/views/collections | |
| parent | db1462bb2ea327a98ca239080e88944425aba768 (diff) | |
merging w/ zach's branch
Diffstat (limited to 'src/client/views/collections')
| -rw-r--r-- | src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx | 50 |
1 files changed, 28 insertions, 22 deletions
diff --git a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx index 3cd1e99ef..d0f65866b 100644 --- a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx +++ b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx @@ -57,6 +57,7 @@ import { CollectionFreeFormRemoteCursors } from './CollectionFreeFormRemoteCurso import './CollectionFreeFormView.scss'; import { MarqueeView } from './MarqueeView'; import { DrawingOptions, SmartDrawHandler } from '../../smartdraw/SmartDrawHandler'; +import { AnnotationPalette } from '../../smartdraw/AnnotationPalette'; @observer class CollectionFreeFormOverlayView extends React.Component<{ elements: () => ViewDefResult[] }> { @@ -662,18 +663,19 @@ export class CollectionFreeFormView extends CollectionSubView<Partial<collection _width: B.width + inkWidth, _height: B.height + inkWidth, stroke_showLabel: BoolCast(Doc.UserDoc().activeInkHideTextLabels)}, // prettier-ignore - inkWidth, - ActiveInkColor(), - ActiveInkBezierApprox(), - ActiveFillColor(), - ActiveArrowStart(), - ActiveArrowEnd(), - ActiveDash(), - ActiveIsInkMask() - ); - }); - newStrokes && this.addDocument?.(newStrokes); - // setTimeout(() => this._eraserLock--); + inkWidth, + ActiveInkColor(), + ActiveInkBezierApprox(), + ActiveFillColor(), + ActiveArrowStart(), + ActiveArrowEnd(), + ActiveDash(), + ActiveIsInkMask() + ); + }); + newStrokes && this.addDocument?.(newStrokes); + // setTimeout(() => this._eraserLock--); + } } }); } @@ -1284,10 +1286,11 @@ export class CollectionFreeFormView extends CollectionSubView<Partial<collection @undoBatch createDrawing = (strokeData: [InkData, string, string][], opts: DrawingOptions, gptRes: string, containerDoc?: Doc) => { this._drawing = []; - this._drawingContainer = undefined; + const xf = this.screenToFreeformContentsXf; + // this._drawingContainer = undefined; strokeData.forEach((stroke: [InkData, string, string]) => { const bounds = InkField.getBounds(stroke[0]); - const B = this.screenToFreeformContentsXf.transformBounds(bounds.left, bounds.top, bounds.width, bounds.height); + const B = xf.transformBounds(bounds.left, bounds.top, bounds.width, bounds.height); const inkWidth = ActiveInkWidth() * this.ScreenToLocalBoxXf().Scale; const inkDoc = Docs.Create.InkDocument( stroke[0], @@ -1299,16 +1302,20 @@ export class CollectionFreeFormView extends CollectionSubView<Partial<collection stroke_showLabel: BoolCast(Doc.UserDoc().activeInkHideTextLabels)}, // prettier-ignore inkWidth, stroke[1], - undefined, - stroke[2] === 'none' ? undefined : stroke[2] + ActiveInkBezierApprox(), + stroke[2] === 'none' ? ActiveFillColor() : stroke[2], + ActiveArrowStart(), + ActiveArrowEnd(), + ActiveDash(), + ActiveIsInkMask() ); this._drawing.push(inkDoc); this.addDocument(inkDoc); }); - const collection = this._marqueeViewRef.current?.collection(undefined, true, this._drawing); + const collection = containerDoc || this._marqueeViewRef.current?.collection(undefined, true, this._drawing); if (collection) { const docData = collection[DocData]; - docData.title = opts.text.match(/^(.*?)~~~.*$/)?.[0] || opts.text; + docData.title = opts.text.match(/^(.*?)~~~.*$/)?.[1] || opts.text; docData.drawingInput = opts.text; docData.drawingComplexity = opts.complexity; docData.drawingColored = opts.autoColor; @@ -1325,10 +1332,10 @@ export class CollectionFreeFormView extends CollectionSubView<Partial<collection const docData = DocCast(doc[DocData]); const children = DocListCast(docData.data); this._props.removeDocument?.(children); - this._props.removeDocument?.(doc); + // this._props.removeDocument?.(doc); } else { this._props.removeDocument?.(this._drawing); - if (this._drawingContainer) this._props.removeDocument?.(this._drawingContainer); + // if (this._drawingContainer) this._props.removeDocument?.(this._drawingContainer); } }; @@ -2038,8 +2045,7 @@ export class CollectionFreeFormView extends CollectionSubView<Partial<collection optionItems.push({ description: 'Show Drawing Editor', event: action(() => { - this._showDrawingEditor = !this._showDrawingEditor; - this._showDrawingEditor ? SmartDrawHandler.Instance.displayRegenerate(this._downX, this._downY - 10, this.createDrawing, this.removeDrawing) : SmartDrawHandler.Instance.hideRegenerate(); + !SmartDrawHandler.Instance._showRegenerate ? SmartDrawHandler.Instance.displayRegenerate(this._downX, this._downY - 10, this.createDrawing, this.removeDrawing) : SmartDrawHandler.Instance.hideRegenerate(); }), icon: 'pen-to-square', }); |
