From b4dc598ff08c7c684daa4b75508e17213d29d8e5 Mon Sep 17 00:00:00 2001
From: yipstanley <stanley_yip@brown.edu>
Date: Sun, 17 Mar 2019 13:34:10 -0400
Subject: commitment is difficult

---
 src/client/views/collections/CollectionFreeFormView.tsx | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

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

diff --git a/src/client/views/collections/CollectionFreeFormView.tsx b/src/client/views/collections/CollectionFreeFormView.tsx
index 95b4f6f19..ea00ce751 100644
--- a/src/client/views/collections/CollectionFreeFormView.tsx
+++ b/src/client/views/collections/CollectionFreeFormView.tsx
@@ -59,17 +59,23 @@ export class CollectionFreeFormView extends CollectionViewBase {
     drop = (e: Event, de: DragManager.DropEvent) => {
         super.drop(e, de);
 
+        let screenX = de.x - (de.data["xOffset"] as number || 0);
+        let screenY = de.y - (de.data["yOffset"] as number || 0);
+        const [x, y] = this.getTransform().transformPoint(screenX, screenY);
         if (!de.data["alias"]) {
             const docView: DocumentView = de.data["documentView"];
             const doc = docView ? docView.props.Document : de.data["document"]
             //this should be able to use translate and scale methods on an Identity transform, no?
-            let screenX = de.x - (de.data["xOffset"] as number || 0);
-            let screenY = de.y - (de.data["yOffset"] as number || 0);
-            const [x, y] = this.getTransform().transformPoint(screenX, screenY);
             doc.SetNumber(KeyStore.X, x);
             doc.SetNumber(KeyStore.Y, y);
             this.bringToFront(doc);
         }
+        else {
+            let newDoc: Document = de.data["newDoc"]
+            newDoc.SetNumber(KeyStore.X, x)
+            newDoc.SetNumber(KeyStore.Y, y)
+            this.bringToFront(newDoc)
+        }
     }
 
     @action
-- 
cgit v1.2.3-70-g09d2

