feat(canvas-v3): Phase 0 flag + ref node canvas 垂直切片(默认关闭)

This commit is contained in:
qiqi committed 2026-12-01 00:10:03 +08:00
1 parent d04dac64bc
commit 2ff86d0840
17 files changed
+490 -13

No files matched your search

+24 -1
View File
@@ -9,11 +9,34 @@
'use strict'
function buildNodeEls(ctx) {
const { CanvasGeometry, CanvasStore, EMPTY_OBJ, NODE_W, NodeCardMemo, addRefFromUrl, batchPortTop, batchSourcesMap, canConnect, cancelRun, config, connTarget, defaultNodeBoxWidth, deleteNodes, duplicateNodes, edges, el, generationConcurrency, hOf, inPortWorld, isBatchSrc, lodViewport, nodeDerived, nodeOnMeasure, nodeOnPreview, nodeOnSelect, nodeTypeH, nodeWidth, nodes, pushHistory, refs, runLLM, runLayerNode, runNode, runOutSources, saveNow, sel, selRef, setConn, setConnTarget, setNotice, setSel, taskCountOf, thumbRev, typesRev, uiZoom, uid, updateNode, visibleIds, wLodEnabled, zoomToNode } = ctx
const { CanvasGeometry, CanvasStore, EMPTY_OBJ, NODE_W, NodeCardMemo, addRefFromUrl, batchPortTop, batchSourcesMap, canConnect, cancelRun, config, connTarget, canvasV3On, defaultNodeBoxWidth, deleteNodes, duplicateNodes, edges, el, generationConcurrency, hOf, inPortWorld, isBatchSrc, lodViewport, nodeDerived, nodeOnMeasure, nodeOnPreview, nodeOnSelect, nodeTypeH, nodeWidth, nodes, pushHistory, refs, runLLM, runLayerNode, runNode, runOutSources, saveNow, sel, selRef, setConn, setConnTarget, setNotice, setSel, taskCountOf, thumbRev, typesRev, uiZoom, uid, updateNode, visibleIds, wLodEnabled, zoomToNode } = ctx
const nodeEls = []
const batchSourcesById = batchSourcesMap
for (const n of nodes) {
if (!visibleIds.has(n.id)) continue
// Canvas V3 P1:未选中的 ref 节点只保留透明 hit proxy,视觉由 canvas 画;选中后恢复完整 NodeCard。
if (canvasV3On && n.type === 'ref' && !sel.includes(n.id)) {
nodeEls.push(el('div', {
key: n.id,
className: 'iwb-node-hit-proxy',
'data-node-id': n.id,
style: { transform: 'translate(' + n.x + 'px, ' + n.y + 'px)', width: nodeWidth(n) + 'px', height: hOf(n) + 'px' },
onPointerDown: (e) => {
if (e.button !== 0) return
e.stopPropagation()
const curSel = selRef.current
const ids = (e.shiftKey || e.metaKey || e.ctrlKey)
? (curSel.includes(n.id) ? curSel.filter((x) => x !== n.id) : curSel.concat([n.id]))
: (curSel.includes(n.id) ? curSel.slice() : [n.id])
const start = {}
for (const x of refs.nodes) if (ids.includes(x.id)) start[x.id] = { x: x.x, y: x.y }
refs.bodyDown = { id: n.id, ids, start, sx: e.clientX / uiZoom(), sy: e.clientY / uiZoom(), active: false }
setSel(ids)
},
onDoubleClick: (e) => { e.stopPropagation() },
}, null))
continue
}
// 细粒度:只传该节点相关的 busy/progress/connTarget(其他节点引用稳定,memo 跳过)
let busySelf = nodeDerived.busyById.get(n.id) || EMPTY_OBJ
let progSelf = nodeDerived.progById.get(n.id) || EMPTY_OBJ