Skip to content

Commit 836b38b

Browse files
committed
improve normalization of workspsace nodes
1 parent 5a976f8 commit 836b38b

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

demo/stories/helpers/tools.tsx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,18 @@ import { ConvertToTrayZone, getDirectiveForTrayModel } from '@projectstorm/react
3131
import { css, Global } from '@storybook/theming';
3232

3333
export const genVerticalNode = () => {
34+
const m1 = new DefaultWorkspacePanelModel('Panel 1');
35+
m1.minimumSize.update({
36+
width: 10,
37+
height: 100
38+
});
39+
3440
const m2 = new DefaultWorkspacePanelModel('Panel 2');
3541
m2.minimumSize.update({
3642
width: 10,
3743
height: 100
3844
});
39-
const node = new ExpandNodeModel()
40-
.setExpand(false, true)
41-
.setVertical(true)
42-
.addModel(new DefaultWorkspacePanelModel('Panel 1').setExpand(false, false))
43-
.addModel(m2);
44-
return node;
45+
return new ExpandNodeModel().setExpand(false, true).setVertical(true).addModel(m1).addModel(m2);
4546
};
4647

4748
export enum DebugOptions {

packages/core/src/entities/node/WorkspaceNodeModel.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ export class WorkspaceNodeModel<
4646
super.normalize();
4747
if (this.parent && this.parent instanceof WorkspaceCollectionModel) {
4848
if (this.children.length === 1) {
49+
this.children[0].size.update(this.size.value);
4950
this.parent.replaceModel(this, this.children[0]);
5051
}
5152
}

0 commit comments

Comments
 (0)