fix: 多tab panel切换异常问题

This commit is contained in:
林熠 2021-10-21 15:32:15 +08:00 committed by lihao.ylh
parent 614159d7b2
commit ed5b10cbf1
2 changed files with 17 additions and 5 deletions

View File

@ -172,8 +172,8 @@ export class Skeleton {
const isInFloatAreaPreferenceExists = this.editor?.getPreference()?.contains(panelNameKey, 'skeleton');
if (isInFloatAreaPreferenceExists) {
const isInFloatAreaFromPreference = this.editor?.getPreference()?.get(panelNameKey, 'skeleton');
const currentIsInFloatArea = panel?.isInFloatArea();
if (isInFloatAreaFromPreference !== currentIsInFloatArea) {
const isCurrentInFloatArea = panel?.isChildOfFloatArea();
if (isInFloatAreaFromPreference !== isCurrentInFloatArea) {
this.toggleFloatStatus(panel);
}
}

View File

@ -154,25 +154,37 @@ export default class Panel implements IWidget {
getContent() {
return this.content;
}
/**
* check is current panel is in float area or not
*
* @returns {boolean}
* @memberof Panel
*/
isInFloatArea(): boolean {
isChildOfFloatArea(): boolean {
return this.parent?.name === 'leftFloatArea';
}
/**
* check is current panel is in fixed area or not
*
* @returns {boolean}
* @memberof Panel
*/
isChildOfFixedArea(): boolean {
return this.parent?.name === 'leftFixedArea';
}
setActive(flag: boolean) {
if (flag === this._actived) {
// TODO: 如果移动到另外一个 container会有问题
return;
}
if (flag) {
if (this.isInFloatArea()) {
// 对于 Area 的直接 Child要专门处理 Float & Fixed 分组切换, 其他情况不需要
if (this.isChildOfFloatArea()) {
this.skeleton.leftFixedArea.container.unactiveAll();
} else {
} else if (this.isChildOfFixedArea()) {
this.skeleton.leftFloatArea.container.unactiveAll();
}
this._actived = true;