diff options
author | usodhi <61431818+usodhi@users.noreply.github.com> | 2021-01-20 20:07:48 -0500 |
---|---|---|
committer | usodhi <61431818+usodhi@users.noreply.github.com> | 2021-01-20 20:07:48 -0500 |
commit | 7b49bca26f95e7bf1e878d4987f061511a5def39 (patch) | |
tree | b160034ebfd770c73071203410b468778fa93697 /src/client/views/nodes/DocumentView.tsx | |
parent | e4c9218e217b617e513259cac90b077431890eaa (diff) | |
parent | 68785a97178d229935c0429791081d7c09312dc3 (diff) |
Merge branch 'master' of https://github.com/browngraphicslab/Dash-Web into filters
Diffstat (limited to 'src/client/views/nodes/DocumentView.tsx')
-rw-r--r-- | src/client/views/nodes/DocumentView.tsx | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/client/views/nodes/DocumentView.tsx b/src/client/views/nodes/DocumentView.tsx index 721418ca8..546eca427 100644 --- a/src/client/views/nodes/DocumentView.tsx +++ b/src/client/views/nodes/DocumentView.tsx @@ -553,10 +553,13 @@ export class DocumentViewInternal extends DocComponent<DocumentViewInternalProps "Linking to document tabs not yet supported. Drop link on document content."); return; } + if (de.complete.annoDragData) de.complete.annoDragData.annotationDocument = de.complete.annoDragData.annotationDocCreator(); const linkSource = de.complete.annoDragData ? de.complete.annoDragData.annotationDocument : de.complete.linkDragData ? de.complete.linkDragData.linkSourceDocument : undefined; if (linkSource && linkSource !== this.props.Document) { e.stopPropagation(); - de.complete.linkDocument = DocUtils.MakeLink({ doc: linkSource }, { doc: this._componentView?.getAnchor() || this.rootDoc }, "link", undefined, undefined, undefined, [de.x, de.y]); + const dropDoc = this._componentView?.getAnchor() || this.rootDoc; + if (de.complete.annoDragData) de.complete.annoDragData.dropDocument = dropDoc; + de.complete.linkDocument = DocUtils.MakeLink({ doc: linkSource }, { doc: dropDoc }, "link", undefined, undefined, undefined, [de.x, de.y]); } } @@ -892,10 +895,11 @@ export class DocumentView extends React.Component<DocumentViewProps> { @computed get panelWidth() { return this.nativeWidth ? this.nativeWidth * this.nativeScaling : this.props.PanelWidth(); } @computed get panelHeight() { if (this.nativeHeight) { - if (this.props.Document._fitWidth) { - return Math.min(this.props.PanelHeight(), NumCast(this.props.Document.scrollHeight, this.props.PanelHeight())); - } - return Math.min(this.props.PanelHeight(), this.nativeHeight * this.nativeScaling); + return Math.min(this.props.PanelHeight(), + this.props.Document._fitWidth ? + Math.max(NumCast(this.props.Document._height), NumCast((this.props.Document.scrollHeight as number) * this.props.PanelWidth() / this.nativeWidth, this.props.PanelHeight())) : + this.nativeHeight * this.nativeScaling + ); } return this.props.PanelHeight(); } |