aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/CollectionFreeFormDocumentView.tsx
diff options
context:
space:
mode:
authorbob <bcz@cs.brown.edu>2019-02-22 15:24:42 -0500
committerbob <bcz@cs.brown.edu>2019-02-22 15:24:42 -0500
commit1e83695f1380b7824d36bdc55305c44117f6da2c (patch)
tree3a2994e6c74657f168e9d9d8cf76ab98c45024c1 /src/client/views/nodes/CollectionFreeFormDocumentView.tsx
parent441775f3e16e56e1516c8fa93d12e4faaae03b38 (diff)
changed PanelSize to PanelWidth/Height
Diffstat (limited to 'src/client/views/nodes/CollectionFreeFormDocumentView.tsx')
-rw-r--r--src/client/views/nodes/CollectionFreeFormDocumentView.tsx24
1 files changed, 15 insertions, 9 deletions
diff --git a/src/client/views/nodes/CollectionFreeFormDocumentView.tsx b/src/client/views/nodes/CollectionFreeFormDocumentView.tsx
index 5568935fa..ad6756918 100644
--- a/src/client/views/nodes/CollectionFreeFormDocumentView.tsx
+++ b/src/client/views/nodes/CollectionFreeFormDocumentView.tsx
@@ -1,4 +1,4 @@
-import { computed } from "mobx";
+import { computed, trace } from "mobx";
import { observer } from "mobx-react";
import { KeyStore } from "../../../fields/KeyStore";
import { NumberField } from "../../../fields/NumberField";
@@ -69,15 +69,25 @@ export class CollectionFreeFormDocumentView extends React.Component<DocumentView
this.props.Document.SetData(KeyStore.ZIndex, h, NumberField)
}
+ @computed
+ get parentScaling() {
+ return this.nativeWidth > 0 ? this.width / this.nativeWidth : 1;
+ }
getTransform = (): Transform => {
- var parentScaling = this.nativeWidth > 0 ? this.width / this.nativeWidth : 1;
return this.props.ScreenToLocalTransform().
- translate(-this.props.Document.GetNumber(KeyStore.X, 0), -this.props.Document.GetNumber(KeyStore.Y, 0)).scale(1 / parentScaling);
+ translate(-this.props.Document.GetNumber(KeyStore.X, 0), -this.props.Document.GetNumber(KeyStore.Y, 0)).scale(1 / this.parentScaling);
+ }
+
+ @computed
+ get docView() {
+ return <DocumentView {...this.props}
+ Scaling={this.parentScaling}
+ ScreenToLocalTransform={this.getTransform}
+ />
}
render() {
- var parentScaling = this.nativeWidth > 0 ? this.width / this.nativeWidth : 1;
return (
<div ref={this._mainCont} style={{
transformOrigin: "left top",
@@ -88,11 +98,7 @@ export class CollectionFreeFormDocumentView extends React.Component<DocumentView
zIndex: this.zIndex,
backgroundColor: "transparent"
}} >
-
- <DocumentView {...this.props}
- Scaling={parentScaling}
- ScreenToLocalTransform={this.getTransform}
- />
+ {this.docView}
</div>
);
}