面板最大化和还原
This commit is contained in:
@@ -48,6 +48,11 @@
|
||||
<script setup>
|
||||
import { ref, computed, onMounted, onUnmounted, defineEmits } from 'vue'
|
||||
import Area from './Area.vue';
|
||||
import { getAreaHandler } from './handlers/AreaHandler';
|
||||
|
||||
// 获取AreaHandler实例
|
||||
const areaHandler = getAreaHandler();
|
||||
|
||||
import Panel from './Panel.vue';
|
||||
import TabPage from './TabPage.vue';
|
||||
import DockIndicator from './DockIndicator.vue';
|
||||
@@ -171,6 +176,44 @@ const onUpdatePosition = (event) => {
|
||||
}
|
||||
};
|
||||
|
||||
// 处理Area更新事件
|
||||
const onAreaUpdated = (event) => {
|
||||
const id = event.areaId;
|
||||
const updates = event.updates;
|
||||
const area = floatingAreas.value.find(a => a.id === id);
|
||||
if (area) {
|
||||
// 合并更新到Area对象
|
||||
Object.assign(area, updates);
|
||||
|
||||
// 如果是最大化状态变化,发送panel.maximize.sync事件
|
||||
if ('maximized' in updates || 'windowState' in updates) {
|
||||
// 查找该区域下的所有Panel
|
||||
const areaState = areaHandler.areaStateManager.getState(id);
|
||||
if (areaState && areaState.children) {
|
||||
const childrenArray = Array.isArray(areaState.children) ? areaState.children : [areaState.children];
|
||||
|
||||
// 查找TabPage
|
||||
childrenArray.forEach(child => {
|
||||
if (child.type === 'TabPage' && child.children) {
|
||||
const tabChildrenArray = Array.isArray(child.children) ? child.children : [child.children];
|
||||
|
||||
// 发送panel.maximize.sync事件给每个Panel
|
||||
tabChildrenArray.forEach(tabChild => {
|
||||
if (tabChild.type === 'Panel') {
|
||||
eventBus.emit(EVENT_TYPES.PANEL_MAXIMIZE_SYNC, {
|
||||
panelId: tabChild.id,
|
||||
areaId: id,
|
||||
maximized: updates.maximized !== undefined ? updates.maximized : (updates.windowState === '最大化' || updates.windowState === 'maximized')
|
||||
}, { componentId: 'dock-layout' });
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const onMaximize = (event) => {
|
||||
const panelId = event.panelId;
|
||||
const areaId = event.areaId;
|
||||
@@ -431,10 +474,10 @@ const setupEventListeners = () => {
|
||||
unsubscribeFunctions.push(eventBus.on(EVENT_TYPES.AREA_DRAG_OVER, handleAreaDragOver, { componentId: 'dock-layout' }));
|
||||
unsubscribeFunctions.push(eventBus.on(EVENT_TYPES.AREA_DRAG_LEAVE, handleAreaDragLeave, { componentId: 'dock-layout' }));
|
||||
unsubscribeFunctions.push(eventBus.on(EVENT_TYPES.AREA_MERGE_REQUEST, handleAreaMergeRequest, { componentId: 'dock-layout' }));
|
||||
unsubscribeFunctions.push(eventBus.on(EVENT_TYPES.AREA_UPDATED, onAreaUpdated, { componentId: 'dock-layout' }));
|
||||
|
||||
// 添加新的下降事件监听器
|
||||
unsubscribeFunctions.push(eventBus.on('area.position.update', onAreaPositionUpdate, { componentId: 'dock-layout' }));
|
||||
unsubscribeFunctions.push(eventBus.on('area.drag.state.update', onAreaDragStateUpdate, { componentId: 'dock-layout' }));
|
||||
unsubscribeFunctions.push(eventBus.on(EVENT_TYPES.AREA_DRAG_STATE_UPDATE, onAreaDragStateUpdate, { componentId: 'dock-layout' }));
|
||||
|
||||
// Tab相关事件
|
||||
unsubscribeFunctions.push(eventBus.on(EVENT_TYPES.TAB_CHANGE, onTabChange, { componentId: 'dock-layout' }));
|
||||
|
||||
Reference in New Issue
Block a user