Repository navigation
Restore maximized view before adding a new panel (patch-package fix for #261) #262
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,3 +10,67 @@ index 736f9ec..4fa1228 100644 | |
| }, | ||
|
|
||
| /** | ||
| --- a/node_modules/golden-layout/dist/goldenlayout.js | ||
| +++ b/node_modules/golden-layout/dist/goldenlayout.js | ||
| @@ -3194,6 +3194,35 @@ | ||
| }, | ||
|
|
||
| /** | ||
| + * Restores the maximised item, if there is one and this | ||
| + * container is not the maximised item itself or inside it. | ||
| + * This must run before the concrete item performs any DOM | ||
| + * manipulations for the new child, otherwise the new element | ||
| + * is inserted relative to the maximised element's temporary | ||
| + * position under the layout root instead of its owning | ||
| + * container. | ||
| + * | ||
| + * @returns {void} | ||
| + */ | ||
| + _$restoreMaximisedItemIfNeeded: function() { | ||
| + var maximisedItem = this.layoutManager && this.layoutManager._maximisedItem; | ||
| + if( maximisedItem && maximisedItem.isMaximised === true ) { | ||
| + var item = this; | ||
| + var isInsideMaximised = false; | ||
| + while( item ) { | ||
| + if( item === maximisedItem ) { | ||
| + isInsideMaximised = true; | ||
| + break; | ||
| + } | ||
| + item = item.parent; | ||
| + } | ||
| + if( !isInsideMaximised ) { | ||
| + maximisedItem.toggleMaximise(); | ||
| + } | ||
| + } | ||
| + }, | ||
| + | ||
| + /** | ||
| * Sets up the tree structure for the newly added child | ||
| * The responsibility for the actual DOM manipulations lies | ||
| * with the concrete item | ||
| @@ -3206,6 +3235,8 @@ | ||
| index = this.contentItems.length; | ||
| } | ||
|
|
||
| + this._$restoreMaximisedItemIfNeeded(); | ||
| + | ||
| this.contentItems.splice( index, 0, contentItem ); | ||
|
|
||
| if( this.config.content === undefined ) { | ||
| @@ -3882,6 +3913,8 @@ | ||
|
|
||
| var newItemSize, itemSize, i, splitterElement; | ||
|
|
||
| + this._$restoreMaximisedItemIfNeeded(); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Restore before a split drop replaces the maximised stack. When a maximised stack belongs to a column, dropping a new panel on its left takes the wrapping branch in
The restore moves only the maximised stack back to its placeholder. Subsequent child additions leave the replacement row outside its owning column, so the DOM and layout tree disagree. Run the destination parent’s restore check before the wrapping branch calls
|
||
| + | ||
| contentItem = this.layoutManager._$normalizeContentItem( contentItem, this ); | ||
|
|
||
| if( index === undefined ) { | ||
| @@ -4621,6 +4654,7 @@ | ||
| } else { | ||
| type = isVertical ? 'column' : 'row'; | ||
| rowOrColumn = this.layoutManager.createContentItem( { type: type }, this ); | ||
| + this.parent._$restoreMaximisedItemIfNeeded(); | ||
| this.parent.replaceChild( this, rowOrColumn ); | ||
|
|
||
| rowOrColumn.addChild( contentItem, insertBefore ? 0 : undefined, true ); | ||
Uh oh!
There was an error while loading. Please reload this page.