perf(canvas): 画布渲染 - 降低大画布节点开销

This commit is contained in:
ddCat
2026-09-24 00:05:32 +08:00
parent 8822cb137c
commit 8a35a0ea98
17 changed files with 734 additions and 352 deletions

View File

@@ -512,6 +512,10 @@ export const useCanvasStore = create<CanvasStore>()(
const current = state.projects.find((project) => project.id === id);
if (!current) return state;
const next = { ...current, ...patch };
if (Object.keys(patch).every((key) => key === "viewport")) {
if (samePersistenceValue(current.viewport, next.viewport)) return state;
return { projects: state.projects.map((project) => project === current ? next : project) };
}
const contentChanged = !sameCanvasContent(current, next);
if (!contentChanged && samePersistenceValue(current.viewport, next.viewport)) return state;
if (contentChanged) next.updatedAt = new Date().toISOString();