Skip to content

Commit

Permalink
feat: addGroup initial sizes
Browse files Browse the repository at this point in the history
  • Loading branch information
mathuo committed Aug 20, 2024
1 parent 9d4f4cb commit 2dc0daf
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
14 changes: 13 additions & 1 deletion packages/dockview-core/src/dockview/dockviewComponent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -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?:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ interface CoreGroupOptions {
hideHeader?: boolean;
skipSetActive?: boolean;
constraints?: Partial<Contraints>;
initialWidth?: number;
initialHeight?: number;
}

export interface GroupOptions extends CoreGroupOptions {
Expand Down

0 comments on commit 2dc0daf

Please sign in to comment.