@@ -263,6 +263,7 @@ export class SidePanelManager extends RefCounted {
263263 private registeredPanels = new Set < RegisteredSidePanel > ( ) ;
264264 dragSource : DragSource | undefined ;
265265 private layoutNeedsUpdate = false ;
266+ private shouldResetFlexGroupSizes = false ;
266267
267268 get visible ( ) {
268269 return this . visibility . visible ;
@@ -333,6 +334,17 @@ export class SidePanelManager extends RefCounted {
333334 this . dragSource = undefined ;
334335 }
335336
337+ /**
338+ * Once a panel is added to a flex group, the panel no longer controls the
339+ * size of the flex group. This resets the flex group sizes so that
340+ * panels can set the size of the flex group. This is useful when
341+ * panel sizes are manually set from the JSON state.
342+ */
343+ reset ( ) {
344+ this . shouldResetFlexGroupSizes = true ;
345+ this . invalidateLayout ( ) ;
346+ }
347+
336348 private makeDropZone (
337349 side : Side ,
338350 crossIndex : number ,
@@ -460,6 +472,7 @@ export class SidePanelManager extends RefCounted {
460472 yield self . sides . bottom . outerDropZoneElement ;
461473 }
462474 updateChildren ( this . centerColumn , getColumnChildren ( ) ) ;
475+ this . shouldResetFlexGroupSizes = false ;
463476 }
464477
465478 private makeCrossGutter ( side : Side , crossIndex : number ) {
@@ -689,12 +702,11 @@ export class SidePanelManager extends RefCounted {
689702 }
690703 const oldLocation = cell . registeredPanel . location . value ;
691704 if ( oldLocation . visible ) {
692- flexGroup . crossSize = Math . max (
693- minSize ,
694- flexGroup . crossSize === - 1
705+ const suggestedSize =
706+ self . shouldResetFlexGroupSizes || flexGroup . crossSize === - 1
695707 ? oldLocation . size
696- : flexGroup . crossSize ,
697- ) ;
708+ : flexGroup . crossSize ;
709+ flexGroup . crossSize = Math . max ( minSize , suggestedSize ) ;
698710 }
699711 if (
700712 oldLocation [ crossKey ] !== crossIndex ||
0 commit comments