From 81b5269e4e934523a6dd69cf066f3e6c4e58019f Mon Sep 17 00:00:00 2001
From: bob <bcz@cs.brown.edu>
Date: Wed, 20 Feb 2019 17:29:53 -0500
Subject: working, but oh so confusing transforms for selections.

---
 src/client/views/collections/CollectionDockingView.tsx | 1 +
 1 file changed, 1 insertion(+)

(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 ceb638ab4..fc5b8dacd 100644
--- a/src/client/views/collections/CollectionDockingView.tsx
+++ b/src/client/views/collections/CollectionDockingView.tsx
@@ -253,6 +253,7 @@ export class DockedFrameRenderer extends React.Component<DockedFrameProps> {
                     AddDocument={undefined}
                     RemoveDocument={undefined}
                     Scaling={this._parentScaling}
+                    PanelSize={[0, 0]}
                     ScreenToLocalTransform={() => {
                         let { scale, translateX, translateY } = Utils.GetScreenTransform(this._mainCont);
                         var props = CollectionDockingView.Instance.props;
-- 
cgit v1.2.3-70-g09d2


From 8f70b15a7050ea505544e83ff7380a743b8e319e Mon Sep 17 00:00:00 2001
From: bob <bcz@cs.brown.edu>
Date: Wed, 20 Feb 2019 17:54:12 -0500
Subject: more fixes for selection.

---
 src/client/views/collections/CollectionDockingView.tsx | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 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 fc5b8dacd..5e30c0390 100644
--- a/src/client/views/collections/CollectionDockingView.tsx
+++ b/src/client/views/collections/CollectionDockingView.tsx
@@ -242,6 +242,20 @@ export class DockedFrameRenderer extends React.Component<DockedFrameProps> {
     @observable
     private Document: Opt<Document>;
 
+    @action
+    setScaling = (r: any) => {
+        let nativeWidth = this.Document!.GetNumber(KeyStore.NativeWidth, 0);
+        let nativeHeight = this.Document!.GetNumber(KeyStore.NativeWidth, 0);
+        this._parentScaling = nativeWidth > 0 ? r.entry.width / nativeWidth : 1;
+        this._nativeWidth = r.entry.width ? r.entry.width : nativeWidth;
+        this._nativeHeight = nativeWidth ? r.entry.width / nativeWidth * nativeHeight : nativeHeight;
+    }
+
+    @observable
+    private _nativeWidth = 0;
+    @observable
+    private _nativeHeight = 0;
+
     render() {
         if (!this.Document)
             return <div></div>
@@ -253,7 +267,7 @@ export class DockedFrameRenderer extends React.Component<DockedFrameProps> {
                     AddDocument={undefined}
                     RemoveDocument={undefined}
                     Scaling={this._parentScaling}
-                    PanelSize={[0, 0]}
+                    PanelSize={[this._nativeWidth, this._nativeHeight]}
                     ScreenToLocalTransform={() => {
                         let { scale, translateX, translateY } = Utils.GetScreenTransform(this._mainCont);
                         var props = CollectionDockingView.Instance.props;
@@ -265,7 +279,7 @@ export class DockedFrameRenderer extends React.Component<DockedFrameProps> {
 
         if (nativeWidth > 0 &&
             (layout.indexOf("CollectionFreeForm") == -1 || layout.indexOf("AnnotationsKey") != -1)) { // contents of documents should be scaled if document is not a freeform view, or if the freeformview is an annotation layer (presumably on a document that is not a freeformview)
-            return <Measure onResize={action((r: any) => this._parentScaling = nativeWidth > 0 ? r.entry.width / nativeWidth : 1)}>
+            return <Measure onResize={this.setScaling}>
                 {({ measureRef }) => <div ref={measureRef}>  {content} </div>}
             </Measure>
         }
-- 
cgit v1.2.3-70-g09d2

