点击修改z-index
This commit is contained in:
@@ -40,7 +40,7 @@
|
||||
:key="area.id"
|
||||
:type="'Area'"
|
||||
:config="area"
|
||||
:style="{ zIndex: area.zIndex || zIndexManager.getFloatingAreaZIndex(area.id) }"
|
||||
:style="{ zIndex: zIndexManager.getFloatingAreaZIndex(area.id) }"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
@@ -126,49 +126,27 @@ const dragOperationCache = new Map();
|
||||
* @returns {boolean} 是否应该操作区域
|
||||
*/
|
||||
const shouldOperateAreaInsteadOfPanel = (areaId) => {
|
||||
console.log(`[DockLayout] 检查单Panel模式,areaId: ${areaId}`);
|
||||
console.log(`[DockLayout] 当前floatingAreas:`, floatingAreas.value);
|
||||
|
||||
const area = floatingAreas.value.find(a => a.id === areaId);
|
||||
if (!area) {
|
||||
console.log(`[DockLayout] 未找到Area: ${areaId}`);
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
// 简化逻辑:直接检查区域的面板数量
|
||||
// 遍历所有子元素,统计Panel数量
|
||||
let panelCount = 0;
|
||||
|
||||
console.log(`[DockLayout] Area ${areaId} 的children:`, area.children);
|
||||
|
||||
const childrenArray = Array.isArray(area.children) ? area.children : [area.children];
|
||||
|
||||
for (const child of childrenArray) {
|
||||
console.log(`[DockLayout] 检查子元素:`, child);
|
||||
if (child.type === 'TabPage' && child.children) {
|
||||
console.log(`[DockLayout] 找到TabPage,children:`, child.children);
|
||||
const tabChildrenArray = Array.isArray(child.children) ? child.children : [child.children];
|
||||
for (const tabChild of tabChildrenArray) {
|
||||
console.log(`[DockLayout] 检查TabPage子元素:`, tabChild);
|
||||
if (tabChild.type === 'Panel') {
|
||||
panelCount++;
|
||||
console.log(`[DockLayout] 找到Panel,当前计数: ${panelCount}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 如果区域中只有一个面板,返回true
|
||||
const result = panelCount === 1;
|
||||
console.log(`[DockLayout] Area ${areaId} 单Panel检查结果:`, result, `(面板数量: ${panelCount})`);
|
||||
if (result) {
|
||||
console.log(`[DockLayout] Area ${areaId} 是单Panel模式,应该操作Area而不是Panel`);
|
||||
}
|
||||
|
||||
return result;
|
||||
return panelCount === 1;
|
||||
} catch (error) {
|
||||
console.error(`[DockLayout] 检查单Panel模式时出错:`, error);
|
||||
return false;
|
||||
}
|
||||
};
|
||||
@@ -182,8 +160,6 @@ const shouldOperateAreaInsteadOfPanel = (areaId) => {
|
||||
const shouldOperateAreaInsteadOfPanelFromData = (data) => {
|
||||
const { panelId, areaId } = data;
|
||||
|
||||
console.log(`🔍 检查单面板模式: areaId=${areaId}, panelId=${panelId}`);
|
||||
|
||||
// 从AreaHandler获取区域状态
|
||||
const areaState = areaHandler.getAreaState(areaId);
|
||||
|
||||
@@ -195,9 +171,7 @@ const shouldOperateAreaInsteadOfPanelFromData = (data) => {
|
||||
}
|
||||
|
||||
// 如果区域中只有一个面板,返回true
|
||||
const result = panelCount === 1;
|
||||
console.log(`✅ 单面板检测结果: ${result} (面板数量: ${panelCount})`);
|
||||
return result;
|
||||
return panelCount === 1;
|
||||
};
|
||||
|
||||
const onCloseFloatingArea = (event) => {
|
||||
@@ -586,6 +560,8 @@ const setupEventListeners = () => {
|
||||
unsubscribeFunctions.push(eventBus.on(EVENT_TYPES.PANEL_CHECK_SINGLE_PANEL, onCheckSinglePanel, { componentId: 'dock-layout' }));
|
||||
// Area位置更新事件
|
||||
unsubscribeFunctions.push(eventBus.on(EVENT_TYPES.AREA_POSITION_UPDATE, onAreaPositionUpdate, { componentId: 'dock-layout' }));
|
||||
// Area z-index更新事件
|
||||
unsubscribeFunctions.push(eventBus.on(EVENT_TYPES.Z_INDEX_UPDATE, onZIndexUpdate, { componentId: 'dock-layout' }));
|
||||
|
||||
// Resize相关事件
|
||||
unsubscribeFunctions.push(eventBus.on(EVENT_TYPES.RESIZE_START, () => emit('dragStart'), { componentId: 'dock-layout' }));
|
||||
@@ -1191,6 +1167,16 @@ const onAreaPositionUpdate = (event) => {
|
||||
}
|
||||
};
|
||||
|
||||
// 处理Area z-index更新事件
|
||||
const onZIndexUpdate = (event) => {
|
||||
const { areaId, zIndex } = event;
|
||||
|
||||
const area = floatingAreas.value.find(a => a.id === areaId);
|
||||
if (area) {
|
||||
area.zIndex = zIndex;
|
||||
}
|
||||
};
|
||||
|
||||
const onAreaResizeEnd = (event) => {
|
||||
const { areaId, direction, finalPosition } = event;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user