From 1ebc4ed2c8b4936e6ba95c1bcf7cd33861a21db0 Mon Sep 17 00:00:00 2001 From: enonymous1 Date: Thu, 12 Nov 2026 17:53:14 -0500 Subject: [PATCH 1/3] Restore maximized view before adding a new panel When a panel is opened from the sidebar while another view is maximized, golden-layout adds the new panel behind the maximized overlay and never lays it out, so it stays invisible until the maximized view is restored manually (#261). Patch AbstractContentItem.addChild (via patch-package) to restore any maximized item first, using toggleMaximise() so the maximized flag and the header button stay consistent. Adding a panel into the maximized item itself (e.g. a new tab in that stack) is unaffected. Tested on Windows (Live at 2e8aa4586, 50 virtual drones): maximize the 3D view, click Clocks in the sidebar, and the Clocks panel appears immediately with no restore step. Fixes #261 --- patches/golden-layout+1.5.9.patch | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/patches/golden-layout+1.5.9.patch b/patches/golden-layout+1.5.9.patch index e404fcbf2..2a9dacf1c 100644 --- a/patches/golden-layout+1.5.9.patch +++ b/patches/golden-layout+1.5.9.patch @@ -10,3 +10,32 @@ index 736f9ec..4fa1228 100644 }, /** +--- a/node_modules/golden-layout/dist/goldenlayout.js ++++ b/node_modules/golden-layout/dist/goldenlayout.js +@@ -3206,6 +3206,26 @@ + index = this.contentItems.length; + } + ++ // If another item is maximised, restore it first so that the ++ // new item is laid out visibly instead of being added behind ++ // the maximised overlay. Skip this when the new item is added ++ // to the maximised item itself (e.g. a new tab in that stack). ++ 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(); ++ } ++ } ++ + this.contentItems.splice( index, 0, contentItem ); + + if( this.config.content === undefined ) { From f0944c4081dfbe67ecb0f474028f3ca4a3d3037b Mon Sep 17 00:00:00 2001 From: enonymous1 Date: Thu, 12 Nov 2026 18:12:52 -0500 Subject: [PATCH 2/3] Restore maximized view before RowOrColumn DOM insertion CodeRabbit review on #262: the restore in the base addChild runs too late -- RowOrColumn.addChild inserts the new panel and splitter beside a sibling's element before calling the base method, so when that sibling is maximized its element is under the layout root and the new elements land in the wrong DOM container. The restore only moves the maximized element back, leaving the new panel and splitter stranded outside their owning row. Extract the restore into _$restoreMaximisedItemIfNeeded on AbstractContentItem and call it from the base addChild (covers the Stack path, whose DOM work runs after the base call) and at the top of RowOrColumn.addChild, before normalize and the DOM insertion, so the maximized item is back in its owning row first. --- patches/golden-layout+1.5.9.patch | 41 +++++++++++++++++++++++++------ 1 file changed, 34 insertions(+), 7 deletions(-) diff --git a/patches/golden-layout+1.5.9.patch b/patches/golden-layout+1.5.9.patch index 2a9dacf1c..589f681d1 100644 --- a/patches/golden-layout+1.5.9.patch +++ b/patches/golden-layout+1.5.9.patch @@ -12,14 +12,21 @@ index 736f9ec..4fa1228 100644 /** --- a/node_modules/golden-layout/dist/goldenlayout.js +++ b/node_modules/golden-layout/dist/goldenlayout.js -@@ -3206,6 +3206,26 @@ - index = this.contentItems.length; - } +@@ -3194,6 +3194,35 @@ + }, -+ // If another item is maximised, restore it first so that the -+ // new item is laid out visibly instead of being added behind -+ // the maximised overlay. Skip this when the new item is added -+ // to the maximised item itself (e.g. a new tab in that stack). + /** ++ * 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; @@ -35,7 +42,27 @@ index 736f9ec..4fa1228 100644 + 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(); ++ + contentItem = this.layoutManager._$normalizeContentItem( contentItem, this ); + + if( index === undefined ) { From 4fcb6f02c41b625bc308a02f24c3665838b93957 Mon Sep 17 00:00:00 2001 From: enonymous1 Date: Thu, 12 Nov 2026 18:36:39 -0500 Subject: [PATCH 3/3] Restore maximized view before split-drop replaceChild Second CodeRabbit review on #262: the Stack._$onDrop wrapping branch (dropping a panel on the edge of a maximized stack whose parent is the wrong orientation) calls replaceChild before any restore runs. replaceChild swaps the stack at its temporary DOM location under the layout root, so the replacement row enters the root instead of the owning column, and the later restore moves only the stack back -- the DOM and the layout tree disagree. Call the destination parent's _$restoreMaximisedItemIfNeeded before replaceChild, so the maximized stack is back in its owning column first. The header/body drop paths (adding a tab into the stack) are unaffected: adding into the maximized item itself still skips the restore. --- patches/golden-layout+1.5.9.patch | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/patches/golden-layout+1.5.9.patch b/patches/golden-layout+1.5.9.patch index 589f681d1..bc23728cf 100644 --- a/patches/golden-layout+1.5.9.patch +++ b/patches/golden-layout+1.5.9.patch @@ -66,3 +66,11 @@ index 736f9ec..4fa1228 100644 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 );