增加重算列表
This commit is contained in:
@@ -303,6 +303,7 @@ const container = ref(null);
|
||||
// 初始化Pinia store
|
||||
const store = useDockPanelStore();
|
||||
|
||||
// 基于 watch 的受影响重算已移除;改为在 store 的增删面板操作中按影响列表统一触发。
|
||||
// 定义布局应用完成后的回调函数,用于刷新面板大小
|
||||
function handleLayoutApplied() {
|
||||
// 确保容器存在后调用refreshPanelSizes并传递容器元素
|
||||
@@ -742,8 +743,8 @@ function handleKeyDown(event) {
|
||||
// 初始化
|
||||
onMounted(() => {
|
||||
// 初始化容器引用
|
||||
const container = document.querySelector('.dock-panel-container');
|
||||
layoutManager.setContainer(container);
|
||||
container.value = document.querySelector('.dock-panel-container');
|
||||
layoutManager.setContainer(container.value);
|
||||
|
||||
// 检查URL参数是否有强制重置布局的标记
|
||||
const urlParams = new URLSearchParams(window.location.search);
|
||||
@@ -778,6 +779,9 @@ onMounted(() => {
|
||||
// 初始化面板大小影响关系
|
||||
initializePanelSizeInfluence();
|
||||
|
||||
// 初始化边界(确保下区宽度按左右面板扣减)
|
||||
store.handlePanelSizeInfluence('bottom', container.value);
|
||||
|
||||
// 添加事件监听
|
||||
document.addEventListener('mousemove', handleMouseMove);
|
||||
document.addEventListener('mouseup', handleMouseUp);
|
||||
|
||||
@@ -339,12 +339,32 @@ export class LayoutCoordinator {
|
||||
}
|
||||
|
||||
// 计算底部面板边界 - 底部面板通常位于最下方,只受容器高度限制
|
||||
// 注意:为避免依赖未计算的左右宽度,这里的底部边界设置被延后至左右边界计算之后
|
||||
if (panelAreas.bottom && panelAreas.bottom.panels && panelAreas.bottom.panels.length > 0) {
|
||||
const bottomInfluencedBy = influenceData.influencedBy.bottom || [];
|
||||
const bottomHeight = panelAreas.bottom.height || 200;
|
||||
let bottomX = 0;
|
||||
let bottomWidth = containerWidth;
|
||||
|
||||
bottomInfluencedBy.forEach(item => {
|
||||
if (item.influence && item.property === 'width') {
|
||||
const pos = item.position;
|
||||
const area = panelAreas[pos];
|
||||
const w = (this.panelBounds[pos]?.width ?? area?.width ?? 0);
|
||||
if (w > 0) {
|
||||
bottomWidth -= w;
|
||||
if (pos === 'left') {
|
||||
bottomX += w;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
this.panelBounds.bottom = {
|
||||
x: 0,
|
||||
y: containerHeight - (panelAreas.bottom.height || 200),
|
||||
width: containerWidth,
|
||||
height: panelAreas.bottom.height || 200
|
||||
x: Math.max(0, bottomX),
|
||||
y: containerHeight - bottomHeight,
|
||||
width: Math.max(0, bottomWidth),
|
||||
height: bottomHeight
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user