diff options
| author | Tyler Schicke <tyler_schicke@brown.edu> | 2019-02-20 20:18:31 -0500 |
|---|---|---|
| committer | Tyler Schicke <tyler_schicke@brown.edu> | 2019-02-20 20:18:31 -0500 |
| commit | 5c147db2e12be2a5aeb57647eda3f4ab43bc697b (patch) | |
| tree | a74675518974f17a4fc21dbf6506592de761a348 /src/client/views/collections/CollectionDockingView.tsx | |
| parent | d218c0998b333c9bf6e905e999ce8b0bf02a72f7 (diff) | |
| parent | 2ec7f43648e5360bb3adb92443d7055abd269346 (diff) | |
Merge branch 'master' of github-tsch-brown:browngraphicslab/Dash-Web
Diffstat (limited to 'src/client/views/collections/CollectionDockingView.tsx')
| -rw-r--r-- | src/client/views/collections/CollectionDockingView.tsx | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/client/views/collections/CollectionDockingView.tsx b/src/client/views/collections/CollectionDockingView.tsx index ceb638ab4..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,6 +267,7 @@ export class DockedFrameRenderer extends React.Component<DockedFrameProps> { AddDocument={undefined} RemoveDocument={undefined} Scaling={this._parentScaling} + PanelSize={[this._nativeWidth, this._nativeHeight]} ScreenToLocalTransform={() => { let { scale, translateX, translateY } = Utils.GetScreenTransform(this._mainCont); var props = CollectionDockingView.Instance.props; @@ -264,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> } |
