From bc7a13cb54d3f60b4e9ad301d17db2941eb84912 Mon Sep 17 00:00:00 2001
From: Tyler Schicke <tyler_schicke@brown.edu>
Date: Sun, 17 Feb 2019 07:50:37 -0500
Subject: Trying to fix drop with transforms

---
 src/client/views/collections/CollectionDockingView.tsx | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

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

diff --git a/src/client/views/collections/CollectionDockingView.tsx b/src/client/views/collections/CollectionDockingView.tsx
index 39716170b..adfcb96ee 100644
--- a/src/client/views/collections/CollectionDockingView.tsx
+++ b/src/client/views/collections/CollectionDockingView.tsx
@@ -15,6 +15,7 @@ import { CollectionViewBase, CollectionViewProps, COLLECTION_BORDER_WIDTH } from
 import React = require("react");
 import * as ReactDOM from 'react-dom';
 import Measure from "react-measure";
+import { Utils } from "../../../Utils";
 
 @observer
 export class CollectionDockingView extends CollectionViewBase {
@@ -239,14 +240,14 @@ export class CollectionDockingView extends CollectionViewBase {
             var containingDiv = "component_" + me.nextId();
             container.getElement().html("<div id='" + containingDiv + "'></div>");
             setTimeout(function () {
-                let divContainer = document.getElementById(containingDiv);
+                let divContainer = document.getElementById(containingDiv) as HTMLDivElement;
                 if (divContainer) {
                     let props: DockingProps = {
                         ContainingDiv: containingDiv,
                         Document: state.doc,
                         Container: container,
                         CollectionDockingView: me,
-                        HtmlElement: divContainer
+                        HtmlElement: divContainer,
                     }
                     ReactDOM.render((<RenderClass {...props} />), divContainer);
                     if (CollectionDockingView.myLayout._maxstack) {
@@ -293,7 +294,7 @@ interface DockingProps {
     Document: Document,
     Container: any,
     HtmlElement: HTMLElement,
-    CollectionDockingView: CollectionDockingView
+    CollectionDockingView: CollectionDockingView,
 }
 @observer
 export class RenderClass extends React.Component<DockingProps> {
@@ -307,8 +308,11 @@ export class RenderClass extends React.Component<DockingProps> {
             <DocumentView key={this.props.Document.Id} Document={this.props.Document}
                 AddDocument={this.props.CollectionDockingView.addDocument}
                 RemoveDocument={this.props.CollectionDockingView.removeDocument}
-                GetTransform={() => Transform.Identity}
                 Scaling={this._parentScaling}
+                GetTransform={() => {
+                    let { scale, translateX, translateY } = Utils.GetScreenTransform(this.props.HtmlElement);
+                    return this.props.CollectionDockingView.props.GetTransform().scale(scale).translate(translateX, translateY)
+                }}
                 isTopMost={true}
                 ContainingCollectionView={this.props.CollectionDockingView} DocumentView={undefined} />
 
-- 
cgit v1.2.3-70-g09d2

