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

@@ -0,0 +1,12 @@
export type CanvasNodeRenderLOD = "shell" | "preview" | "full";
// Hysteresis prevents mounting/unmounting editors around the overview boundary.
export function canvasOverviewMode(scale: number, previous: boolean) {
return previous ? scale < 0.27 : scale < 0.23;
}
export function resolveCanvasNodeLOD(overview: boolean, inView: boolean, inEntry: boolean, editing: boolean): CanvasNodeRenderLOD {
if (editing) return "full";
if (inView) return overview ? "preview" : "full";
return inEntry ? "preview" : "shell";
}