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

fix: 修复 onDockShow / onDockHide 事件
This commit is contained in:
力皓 2020-12-15 12:51:04 +08:00 committed by 砚心
parent 4bc4ddec9d
commit 64439982c0
3 changed files with 13 additions and 4 deletions

View File

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

View File

@ -158,6 +158,11 @@ export default class Panel implements IWidget {
if (flag) { if (flag) {
this._actived = true; this._actived = true;
this.parent?.active(this); 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) { if (!this.inited) {
this.inited = true; 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 { add(item: T | G): T {
item = this.handle(item); item = this.handle(item);
const origin = this.get(item.name); const origin = this.get(item.name);