diff options
author | bob <bcz@cs.brown.edu> | 2019-02-20 18:02:36 -0500 |
---|---|---|
committer | bob <bcz@cs.brown.edu> | 2019-02-20 18:02:36 -0500 |
commit | 778abc78c6f423ec9247a9f9b1fe6a60ea07531c (patch) | |
tree | ef2bce32f2915a24eb9dbe389cfdb07f2ccc294b /src/client/views/nodes/DocumentView.tsx | |
parent | 8f70b15a7050ea505544e83ff7380a743b8e319e (diff) |
piddling.
Diffstat (limited to 'src/client/views/nodes/DocumentView.tsx')
-rw-r--r-- | src/client/views/nodes/DocumentView.tsx | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/client/views/nodes/DocumentView.tsx b/src/client/views/nodes/DocumentView.tsx index fa39ad09a..4eb49f18f 100644 --- a/src/client/views/nodes/DocumentView.tsx +++ b/src/client/views/nodes/DocumentView.tsx @@ -267,24 +267,20 @@ export class DocumentView extends React.Component<DocumentViewProps> { if (!lkeys || lkeys === "<Waiting>") { return <p>Error loading layout keys</p>; } - let backgroundBindings = { + let documentBindings = { ...this.props, - ScreenToLocalTransform: this.backgroundScreenToLocalTransform, // adds 'Scaling' to the screen to local Xf + ScreenToLocalTransform: this.documentScreenToLocalTransform, // adds 'Scaling' to the screen to local Xf isSelected: this.isSelected, select: this.select } as any; for (const key of this.layoutKeys) { - backgroundBindings[key.Name + "Key"] = key; // this maps string values of the form <keyname>Key to an actual key Kestore.keyname e.g, "DataKey" => KeyStore.Data + documentBindings[key.Name + "Key"] = key; // this maps string values of the form <keyname>Key to an actual key Kestore.keyname e.g, "DataKey" => KeyStore.Data } for (const key of this.layoutFields) { let field = this.props.Document.Get(key); - backgroundBindings[key.Name] = field && field != FieldWaiting ? field.GetValue() : field; + documentBindings[key.Name] = field && field != FieldWaiting ? field.GetValue() : field; } - let documentBindings = { - ...backgroundBindings, - ScreenToLocalTransform: this.documentScreenToLocalTransform, // adds 'Scaling' to the screen to local Xf - } /* tfs: Should this be moved to CollectionFreeformView or another component that renders @@ -293,6 +289,10 @@ export class DocumentView extends React.Component<DocumentViewProps> { */ let backgroundLayout = this.backgroundLayout; if (backgroundLayout) { + let backgroundBindings = { + ...documentBindings, + ScreenToLocalTransform: this.backgroundScreenToLocalTransform, // adds 'Scaling' to the screen to local Xf + } let backgroundView = () => (<JsxParser components={{ FormattedTextBox, ImageBox, CollectionFreeFormView, CollectionDockingView, CollectionSchemaView }} bindings={backgroundBindings} @@ -303,13 +303,13 @@ export class DocumentView extends React.Component<DocumentViewProps> { documentBindings.BackgroundView = backgroundView; } - var width = this.props.Document.GetNumber(KeyStore.NativeWidth, 0); - var strwidth = width > 0 ? width.toString() + "px" : "100%"; - var height = this.props.Document.GetNumber(KeyStore.NativeHeight, 0); - var strheight = height > 0 ? height.toString() + "px" : "100%"; + var nativeWidth = this.props.Document.GetNumber(KeyStore.NativeWidth, 0); + var nativeHeight = this.props.Document.GetNumber(KeyStore.NativeHeight, 0); + var nodeWidth = nativeWidth > 0 ? nativeWidth.toString() + "px" : "100%"; + var nodeHeight = nativeHeight > 0 ? nativeHeight.toString() + "px" : "100%"; var scaling = this.props.Scaling; return ( - <div className="documentView-node" ref={this._mainCont} style={{ width: strwidth, height: strheight, transformOrigin: "left top", transform: `scale(${scaling},${scaling})` }} + <div className="documentView-node" ref={this._mainCont} style={{ width: nodeWidth, height: nodeHeight, transformOrigin: "left top", transform: `scale(${scaling},${scaling})` }} onContextMenu={this.onContextMenu} onPointerDown={this.onPointerDown} > <JsxParser |