diff --git a/packages/dockview-core/src/dockview/dockviewComponent.ts b/packages/dockview-core/src/dockview/dockviewComponent.ts index b06410090..517f7c8b1 100644 --- a/packages/dockview-core/src/dockview/dockviewComponent.ts +++ b/packages/dockview-core/src/dockview/dockviewComponent.ts @@ -1640,7 +1640,12 @@ export class DockviewComponent ); const group = this.createGroup(options); - this.doAddGroup(group, relativeLocation); + const size = + this.getLocationOrientation(relativeLocation) === + Orientation.VERTICAL + ? options.initialHeight + : options.initialWidth; + this.doAddGroup(group, relativeLocation, size); if (!options.skipSetActive) { this.doSetGroupAndPanelActive(group); } @@ -1654,6 +1659,13 @@ export class DockviewComponent } } + private getLocationOrientation(location: number[]) { + return location.length % 2 == 0 && + this.gridview.orientation === Orientation.HORIZONTAL + ? Orientation.HORIZONTAL + : Orientation.VERTICAL; + } + removeGroup( group: DockviewGroupPanel, options?: diff --git a/packages/dockview-core/src/dockview/dockviewGroupPanelModel.ts b/packages/dockview-core/src/dockview/dockviewGroupPanelModel.ts index ae3c07ae3..1d02d4d33 100644 --- a/packages/dockview-core/src/dockview/dockviewGroupPanelModel.ts +++ b/packages/dockview-core/src/dockview/dockviewGroupPanelModel.ts @@ -52,6 +52,8 @@ interface CoreGroupOptions { hideHeader?: boolean; skipSetActive?: boolean; constraints?: Partial; + initialWidth?: number; + initialHeight?: number; } export interface GroupOptions extends CoreGroupOptions {