From f84a8d79c07bdd55e48acc976227a2ceeb457e5f Mon Sep 17 00:00:00 2001
From: eleanor-park <eleanor_park@brown.edu>
Date: Tue, 2 Jul 2024 14:35:58 -0400
Subject: bug creating drawing groups

---
 .../collectionFreeForm/CollectionFreeFormView.tsx  | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 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 467191735..09bb3649d 100644
--- a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx
+++ b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx
@@ -1270,7 +1270,7 @@ export class CollectionFreeFormView extends CollectionSubView<Partial<collection
 
     _drawing: Doc[] = [];
     @undoBatch
-    createDrawing = (e: React.PointerEvent<Element>, strokeData: [InkData, string, string][], opts: DrawingOptions, gptRes: string) => {
+    createDrawing = (e: React.PointerEvent<Element>, strokeData: [InkData, string, string][], opts: DrawingOptions, gptRes: string, containerDoc?: Doc) => {
         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);
@@ -1291,16 +1291,16 @@ export class CollectionFreeFormView extends CollectionSubView<Partial<collection
             this._drawing.push(inkDoc);
             this.addDocument(inkDoc);
         });
-        // const collection = this._marqueeViewRef.current?.collection(undefined, false, this._drawing);
-        // if (collection) {
-        //     const docData = collection[DocData];
-        //     docData.title = opts.text;
-        //     docData.drawingInput = opts.text;
-        //     docData.drawingComplexity = opts.complexity;
-        //     docData.drawingColored = opts.autoColor;
-        //     docData.drawingSize = opts.size;
-        //     docData.drawingData = gptRes;
-        // }
+        const collection = this._marqueeViewRef.current?.collection(undefined, true, this._drawing);
+        if (collection) {
+            const docData = collection[DocData];
+            docData.title = opts.text;
+            docData.drawingInput = opts.text;
+            docData.drawingComplexity = opts.complexity;
+            docData.drawingColored = opts.autoColor;
+            docData.drawingSize = opts.size;
+            docData.drawingData = gptRes;
+        }
         this._batch?.end();
     };
 
-- 
cgit v1.2.3-70-g09d2

