From 215ad40efa2e343e290d18bffbc55884829f1a0d Mon Sep 17 00:00:00 2001
From: bobzel <zzzman@gmail.com>
Date: Tue, 4 Mar 2025 00:52:53 -0500
Subject: fixed up smartDrawHandler a bit to support svg's better.  you can now
 drop in a .svg file from the filesystem - still some unfinished business
 (arcs,  background/foreground color inversion)

---
 .../collectionFreeForm/CollectionFreeFormView.tsx  | 36 +---------------------
 1 file changed, 1 insertion(+), 35 deletions(-)

(limited to 'src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx')

diff --git a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx
index aa9b9b0fa..b3d908da4 100644
--- a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx
+++ b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx
@@ -30,7 +30,7 @@ import { CompileScript } from '../../../util/Scripting';
 import { ScriptingGlobals } from '../../../util/ScriptingGlobals';
 import { freeformScrollMode, SnappingManager } from '../../../util/SnappingManager';
 import { Transform } from '../../../util/Transform';
-import { undoable, undoBatch, UndoManager } from '../../../util/UndoManager';
+import { undoable, UndoManager } from '../../../util/UndoManager';
 import { Timeline } from '../../animationtimeline/Timeline';
 import { ContextMenu } from '../../ContextMenu';
 import { InkingStroke } from '../../InkingStroke';
@@ -1232,7 +1232,6 @@ export class CollectionFreeFormView extends CollectionSubView<Partial<collection
     @action
     showSmartDraw = (x: number, y: number, regenerate?: boolean) => {
         const sm = SmartDrawHandler.Instance;
-        sm.CreateDrawingDoc = this.createDrawingDoc;
         sm.RemoveDrawing = this.removeDrawing;
         sm.AddDrawing = this.addDrawing;
         (regenerate ? sm.displayRegenerate : sm.displaySmartDrawHandler)(x, y, NumCast(this.layoutDoc[this.scaleFieldKey]));
@@ -1240,38 +1239,6 @@ export class CollectionFreeFormView extends CollectionSubView<Partial<collection
 
     _drawing: Doc[] = [];
     _drawingContainer: Doc | undefined = undefined;
-    /**
-     * Function that creates a drawing--a group of ink strokes--to go with the smart draw function.
-     */
-    @undoBatch
-    createDrawingDoc = (strokeData: [InkData, string, string][], opts: DrawingOptions) => {
-        this._drawing = [];
-        const xf = this.screenToFreeformContentsXf;
-        strokeData.forEach((stroke: [InkData, string, string]) => {
-            const bounds = InkField.getBounds(stroke[0]);
-            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],
-                { title: 'stroke',
-                    x: B.x - inkWidth / 2,
-                    y: B.y - inkWidth / 2,
-                    _width: B.width + inkWidth,
-                    _height: B.height + inkWidth,
-                    stroke_showLabel: BoolCast(Doc.UserDoc().activeHideTextLabels)}, // prettier-ignore
-                inkWidth,
-                opts.autoColor ? stroke[1] : ActiveInkColor(),
-                ActiveInkBezierApprox(),
-                stroke[2] === 'none' ? ActiveInkFillColor() : stroke[2],
-                ActiveInkArrowStart(),
-                ActiveInkArrowEnd(),
-                ActiveInkDash(),
-                ActiveIsInkMask()
-            );
-            this._drawing.push(inkDoc);
-        });
-        return MarqueeView.getCollection(this._drawing, undefined, true, { left: opts.x, top: opts.y, width: 1, height: 1 });
-    };
 
     /**
      * Part of regenerating a drawing--deletes the old drawing.
@@ -2007,7 +1974,6 @@ export class CollectionFreeFormView extends CollectionSubView<Partial<collection
             optionItems.push({
                 description: 'Regenerate AI Drawing',
                 event: action(() => {
-                    SmartDrawHandler.Instance.CreateDrawingDoc = this.createDrawingDoc;
                     SmartDrawHandler.Instance.AddDrawing = this.addDrawing;
                     SmartDrawHandler.Instance.RemoveDrawing = this.removeDrawing;
                     !SmartDrawHandler.Instance.ShowRegenerate ? SmartDrawHandler.Instance.displayRegenerate(this._downX, this._downY - 10) : SmartDrawHandler.Instance.hideRegenerate();
-- 
cgit v1.2.3-70-g09d2

