diff options
author | bob <bcz@cs.brown.edu> | 2019-02-20 17:54:12 -0500 |
---|---|---|
committer | bob <bcz@cs.brown.edu> | 2019-02-20 17:54:12 -0500 |
commit | 8f70b15a7050ea505544e83ff7380a743b8e319e (patch) | |
tree | 7cea5d1a77beadbb9441daddccd78e99e8b98ffa /src | |
parent | fd4f12795e0944ec6e4122274ff7e2f309663192 (diff) |
more fixes for selection.
Diffstat (limited to 'src')
-rw-r--r-- | src/client/views/collections/CollectionDockingView.tsx | 18 |
1 files changed, 16 insertions, 2 deletions
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> } |