优化最小化窗口存储方式,从保存完整实例改为只保存ID列表以减少存储和避免重复数据
This commit is contained in:
@@ -166,6 +166,8 @@ export class LayoutPersistence {
|
|||||||
|
|
||||||
// 浮动窗口数据
|
// 浮动窗口数据
|
||||||
floatingWindows: this.panelCollections.floatingWindows || [],
|
floatingWindows: this.panelCollections.floatingWindows || [],
|
||||||
|
// 最小化窗口数据 - 只保存ID列表以优化存储
|
||||||
|
minimizedWindowsIds: (this.panelCollections.minimizedWindows || []).map(w => w.id) || [],
|
||||||
|
|
||||||
activeCenterTab: this.layoutState.activeCenterTab,
|
activeCenterTab: this.layoutState.activeCenterTab,
|
||||||
timestamp: new Date().toISOString()
|
timestamp: new Date().toISOString()
|
||||||
@@ -275,6 +277,20 @@ export class LayoutPersistence {
|
|||||||
this.panelCollections.floatingWindows = layout.floatingWindows;
|
this.panelCollections.floatingWindows = layout.floatingWindows;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Array.isArray(layout.minimizedWindowsIds) && this.panelCollections.minimizedWindows && this.panelCollections.floatingWindows) {
|
||||||
|
// 清空现有最小化窗口列表
|
||||||
|
this.panelCollections.minimizedWindows = [];
|
||||||
|
|
||||||
|
// 根据保存的ID列表,从浮动窗口中找到对应的窗口并添加到最小化列表
|
||||||
|
layout.minimizedWindowsIds.forEach(windowId => {
|
||||||
|
const window = this.panelCollections.floatingWindows.find(w => w.id === windowId);
|
||||||
|
if (window) {
|
||||||
|
window.minimized = true; // 确保窗口标记为最小化
|
||||||
|
this.panelCollections.minimizedWindows.push(window);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// 应用激活标签
|
// 应用激活标签
|
||||||
if (layout.activeCenterTab !== undefined) {
|
if (layout.activeCenterTab !== undefined) {
|
||||||
// 现在layoutState是store对象,直接更新其中的activeCenterTab
|
// 现在layoutState是store对象,直接更新其中的activeCenterTab
|
||||||
|
|||||||
Reference in New Issue
Block a user