提交 7fdb1e79 编写于 作者: S Sandeep Somavarapu

Fix #50246

上级 37886aa1
......@@ -121,7 +121,7 @@ export class CompositeBar extends Widget implements ICompositeBar {
public addComposite({ id, name, order }: { id: string; name: string, order: number }, open: boolean): void {
const state = this.storedState.filter(s => s.id === id)[0];
const pinned = state ? state.pinned : true;
let index = this.model.items.length;
let index = order >= 0 ? order : this.model.items.length;
if (state) {
// Find the index by looking its previous item
......@@ -137,9 +137,10 @@ export class CompositeBar extends Widget implements ICompositeBar {
}
// Add to the model
if (this.addToModel(id, name, order, pinned, index)) {
if (open) {
this.pin(id, true);
if (this.model.add(id, name, order, index)) {
this.computeSizes([this.model.findItem(id)]);
if (pinned || open) {
this.pin(id, open);
} else {
this.updateCompositeSwitcher();
}
......@@ -259,14 +260,6 @@ export class CompositeBar extends Widget implements ICompositeBar {
return item && item.activityAction;
}
private addToModel(id: string, name: string, order: number, pinned: boolean, index: number): boolean {
if (this.model.add(id, name, order, pinned, index)) {
this.computeSizes([this.model.findItem(id)]);
return true;
}
return false;
}
private computeSizes(items: ICompositeBarItem[]): void {
const size = this.options.compositeSize;
if (size) {
......@@ -482,7 +475,7 @@ class CompositeBarModel {
};
}
add(id: string, name: string, order: number, pinned: boolean, index: number): boolean {
add(id: string, name: string, order: number, index: number): boolean {
const item = this.findItem(id);
if (item) {
item.order = order;
......@@ -495,7 +488,7 @@ class CompositeBarModel {
index++;
}
}
this.items.splice(index, 0, this.createCompositeBarItem(id, name, order, pinned));
this.items.splice(index, 0, this.createCompositeBarItem(id, name, order, false));
return true;
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册