diff options
| author | yipstanley <stanley_yip@brown.edu> | 2019-07-29 21:21:03 -0400 |
|---|---|---|
| committer | yipstanley <stanley_yip@brown.edu> | 2019-07-29 21:21:03 -0400 |
| commit | 5d30b565fb2ab2d3c9f67fdd9776e08c8a95902e (patch) | |
| tree | 808b6e46c8357b9fb82106ea7673fb97ea9a5d2b /src/client/views/collections/CollectionDockingView.tsx | |
| parent | e042f916375fbe4f23288ece0dcec5b61ef2fbed (diff) | |
| parent | 2514917040d24c04a489905c7a1fe4d10013fd31 (diff) | |
Merge branch 'master' of https://github.com/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, 15 insertions, 2 deletions
diff --git a/src/client/views/collections/CollectionDockingView.tsx b/src/client/views/collections/CollectionDockingView.tsx index 1859ebee7..ab4d1aa62 100644 --- a/src/client/views/collections/CollectionDockingView.tsx +++ b/src/client/views/collections/CollectionDockingView.tsx @@ -211,7 +211,20 @@ export class CollectionDockingView extends React.Component<SubCollectionViewProp } let docContentConfig = CollectionDockingView.makeDocumentConfig(document, dataDocument); var newContentItem = stack.layoutManager.createContentItem(docContentConfig, this._goldenLayout); - stack.addChild(newContentItem.contentItems[0], undefined); + if (stack === undefined) { + if (this._goldenLayout.root.contentItems.length === 0) { + this._goldenLayout.root.addChild(newContentItem); + } else { + const rowOrCol = this._goldenLayout.root.contentItems[0]; + if (rowOrCol.contentItems.length) { + rowOrCol.contentItems[0].addChild(newContentItem); + } else { + rowOrCol.addChild(newContentItem); + } + } + } else { + stack.addChild(newContentItem.contentItems[0], undefined); + } this.layoutChanged(); } @@ -561,7 +574,7 @@ export class DockedFrameRenderer extends React.Component<DockedFrameProps> { } return Transform.Identity(); } - get previewPanelCenteringOffset() { return this.nativeWidth && !BoolCast(this._document!.ignoreAspect) ? (this._panelWidth - this.nativeWidth() * this.contentScaling()) / 2 : 0; } + get previewPanelCenteringOffset() { return this.nativeWidth && !BoolCast(this._document!.ignoreAspect) ? (this._panelWidth - this.nativeWidth()) / 2 : 0; } addDocTab = (doc: Doc, dataDoc: Doc | undefined, location: string) => { if (doc.dockingConfig) { |
