fix: 修复大纲树和组件面板来回点击异常

fix: 修复 onDockShow / onDockHide 事件
This commit is contained in:
力皓 2020-12-15 12:51:04 +08:00
parent e18a3863cf
commit 8b9a6ecf5d
3 changed files with 13 additions and 4 deletions

View File

@ -206,9 +206,9 @@ const dockPane = Object.assign(skeleton.leftArea, {
const f = (_: any, dock: any) => {
fn(dock);
};
editor.on('skeleton.panel-dock.show', f);
editor.on('skeleton.panel-dock.active', f);
return () => {
editor.removeListener('skeleton.panel-dock.show', f);
editor.removeListener('skeleton.panel-dock.active', f);
};
},
/**
@ -218,9 +218,9 @@ const dockPane = Object.assign(skeleton.leftArea, {
const f = (_: any, dock: any) => {
fn(dock);
};
editor.on('skeleton.panel-dock.hide', f);
editor.on('skeleton.panel-dock.unactive', f);
return () => {
editor.removeListener('skeleton.panel-dock.hide', f);
editor.removeListener('skeleton.panel-dock.unactive', f);
};
},
/**

View File

@ -162,6 +162,11 @@ export default class Panel implements IWidget {
if (flag) {
this._actived = true;
this.parent?.active(this);
if (this.parent.name === 'leftFloatArea') {
this.skeleton.leftFixedArea.container.unactiveAll();
} else if (this.parent.name === 'leftFixedArea') {
this.skeleton.leftFloatArea.container.unactiveAll();
}
if (!this.inited) {
this.inited = true;
}

View File

@ -79,6 +79,10 @@ export default class WidgetContainer<T extends WidgetItem = any, G extends Widge
}
}
unactiveAll() {
Object.keys(this.maps).forEach(name => this.unactive(name));
}
add(item: T | G): T {
item = this.handle(item);
const origin = this.get(item.name);