feat: addGroup initial sizes

This commit is contained in:
mathuo 2024-08-20 22:00:21 +01:00
parent 9d4f4cb534
commit 2dc0dafa5a
No known key found for this signature in database
GPG Key ID: C6EEDEFD6CA07281
2 changed files with 15 additions and 1 deletions

View File

@ -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?:

View File

@ -52,6 +52,8 @@ interface CoreGroupOptions {
hideHeader?: boolean;
skipSetActive?: boolean;
constraints?: Partial<Contraints>;
initialWidth?: number;
initialHeight?: number;
}
export interface GroupOptions extends CoreGroupOptions {