feat(canvas-v3): Phase 0 flag + ref node canvas 垂直切片(默认关闭)
This commit is contained in:
1 parent
d04dac64bc
commit
2ff86d0840
17 files changed
+490
-13
No files matched your search
@@ -98,6 +98,7 @@ try { if (window.IWBMiniMapFit && typeof window.IWBMiniMapFit.install === 'funct
|
||||
}
|
||||
// v3.26.143:默认不提升 world/grid 合成层(参考 infinite-canvas);诊断页可显式 opt-in。
|
||||
try { document.documentElement.dataset.layers = lsGet('iwb_layers_on', false) ? 'on' : 'off' } catch (e) { /* ignore */ }
|
||||
try { const V3 = (typeof window !== 'undefined' && window.IWBCanvasV3); if (V3 && typeof V3.init === 'function') V3.init() } catch (e) { /* ignore */ }
|
||||
try { if (lsGet('iwb_noblur_on', false)) document.documentElement.dataset.noblur = 'on' } catch (e) { /* ignore */ }
|
||||
// 桌面端保存二进制:有导出目录直接写 Uint8Array(不弹框),没目录才弹「另存为」;刻意不经 base64,省一次全量编解码。
|
||||
const wSaveBlobNative = async (blob, name, title) => {
|
||||
@@ -3472,6 +3473,7 @@ try { if (window.IWBMiniMapFit && typeof window.IWBMiniMapFit.install === 'funct
|
||||
// 连线几何与合法性(纯函数收编到 src/canvas-geometry.js,P2-9):无依赖,直接用模块
|
||||
const CanvasGeometry = (typeof window !== 'undefined' && window.IWBCanvasGeometry) || null
|
||||
const IWBCanvasEdges = (typeof window !== 'undefined' && window.IWBCanvasEdges) || { EdgeCanvas: () => null }
|
||||
const IWCanvasV3NodeLayer = (typeof window !== 'undefined' && window.IWBCanvasV3NodeLayer) || { CanvasNodeLayer: () => null }
|
||||
// 撤销历史快照纯判定(收编到 src/canvas-history.js,P2-9):无依赖,直接用模块
|
||||
const CanvasHistory = (typeof window !== 'undefined' && window.IWBCanvasHistory) || null
|
||||
// 工作台列表纯变换(收编到 src/workspace-list.js,状态模型 epic · Pilot 3 片 A):无依赖,直接用模块
|
||||
@@ -6015,6 +6017,7 @@ const tbCenterSeed = (type, refs) => {
|
||||
const [groupNameDraft, setGroupNameDraft] = useState('')
|
||||
const [selEdge, setSelEdge] = useState(null)
|
||||
const [hoverEdgeId, setHoverEdgeId] = useState(null)
|
||||
const canvasV3On = !!(typeof window !== 'undefined' && window.IWBCanvasV3 && window.IWBCanvasV3.isEnabled && window.IWBCanvasV3.isEnabled())
|
||||
const [conn, setConn] = useState(null)
|
||||
const [connTarget, setConnTarget] = useState(null)
|
||||
const [ctxMenu, setCtxMenu] = useState(null)
|
||||
@@ -7345,8 +7348,9 @@ const tbCenterSeed = (type, refs) => {
|
||||
// 松手/停止滚轮后再提交一次 state,保证与 React 渲染值一致。
|
||||
const applyViewportDom = (x, y, scale) => {
|
||||
CanvasGeometry.applyViewportDom(canvasEl.el, canvasSize, x, y, scale, refs.gridOpts)
|
||||
// 边线视觉层是 canvas:手势期间命令式重画,避免等 React
|
||||
// 边线/节点 canvas:手势期间命令式重画,避免等 React
|
||||
try { if (typeof refs.edgeCanvasDraw === 'function') refs.edgeCanvasDraw(x, y, scale) } catch (e) { /* ignore */ }
|
||||
try { if (typeof refs.nodeCanvasDraw === 'function') refs.nodeCanvasDraw(x, y, scale) } catch (e) { /* ignore */ }
|
||||
}
|
||||
|
||||
// LOD 滞回状态:plain 在 <15% 进入、>18% 退出(用 ref 保存,不触发额外渲染)
|
||||
@@ -7643,7 +7647,7 @@ const tbCenterSeed = (type, refs) => {
|
||||
))
|
||||
}
|
||||
const nodeEls = IWBCanvasNodes.buildNodeEls({
|
||||
CanvasGeometry, CanvasStore, EMPTY_OBJ, NODE_W, NodeCardMemo, addRefFromUrl, batchPortTop, batchSourcesMap, canConnect, cancelRun, config, connTarget,
|
||||
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,
|
||||
@@ -8077,6 +8081,13 @@ const tbCenterSeed = (type, refs) => {
|
||||
computeEdgePath, viewport, selEdge, focusNodeId, edgeHover, hoverEdgeId, tempD, connTarget,
|
||||
onReady: (fn) => { refs.edgeCanvasDraw = fn },
|
||||
}),
|
||||
// Canvas V3:未选中的 ref 节点卡片/图片画在 canvas;DOM 只保留 hit proxy。
|
||||
canvasV3On ? el(IWCanvasV3NodeLayer.CanvasNodeLayer, {
|
||||
nodes: nodes.filter((n) => visibleIds.has(n.id)), viewport, sel,
|
||||
widthOf: nodeWidth, heightOf: hOf,
|
||||
imageFor: (node, raw) => { try { return wImgSrcForNode(raw, 320) || '' } catch (e) { return '' } },
|
||||
onReady: (fn) => { refs.nodeCanvasDraw = fn },
|
||||
}) : null,
|
||||
// 透明 hit path:选择/双击/悬停仍走 SVG(canvas pointer-events:none)。
|
||||
el('svg', Object.assign({ className: 'iwb-edges' }, CanvasGeometry.edgeLayerProps(canvasSize)),
|
||||
el('g', { className: 'iwb-edge-world', transform: CanvasGeometry.edgeGroupTransform(viewport) }, edgeEls)),
|
||||
@@ -8145,7 +8156,7 @@ const tbCenterSeed = (type, refs) => {
|
||||
onSaveNow: saveNow,
|
||||
config,
|
||||
diagStats: () => wDiagStats(refs.nodes, refs.workspaces),
|
||||
diagExtras: () => ({ persist: storagePersist, swallowed: (RuntimeMetrics && RuntimeMetrics.snapshot) ? RuntimeMetrics.snapshot() : null, procRssMB: wProcRssMB, layers: !!(document && document.documentElement && document.documentElement.dataset.layers === 'on'), noblur: (document && document.documentElement && document.documentElement.dataset.noblur === 'on'), dom: (function () { try { return { els: document.getElementsByTagName('*').length, dock: document.querySelectorAll('.iwb-dock *').length, cards: document.querySelectorAll('.iwb-history-item').length } } catch (e) { return null } })() }), // v3.26.121 RSS + v3.26.127 DOM 规模 // 持久化 + 被忽略错误(2026-11-07)
|
||||
diagExtras: () => ({ persist: storagePersist, swallowed: (RuntimeMetrics && RuntimeMetrics.snapshot) ? RuntimeMetrics.snapshot() : null, procRssMB: wProcRssMB, layers: !!(document && document.documentElement && document.documentElement.dataset.layers === 'on'), canvasV3: !!(window && window.IWBCanvasV3 && window.IWBCanvasV3.isEnabled && window.IWBCanvasV3.isEnabled()), noblur: (document && document.documentElement && document.documentElement.dataset.noblur === 'on'), dom: (function () { try { return { els: document.getElementsByTagName('*').length, dock: document.querySelectorAll('.iwb-dock *').length, cards: document.querySelectorAll('.iwb-history-item').length } } catch (e) { return null } })() }), // v3.26.121 RSS + v3.26.127 DOM 规模 // 持久化 + 被忽略错误(2026-11-07)
|
||||
...autoBackupKit, // autoBackup / autoBackupSave / autoBackupRestore / autoBackupRefresh
|
||||
diagText: () => buildRuntimeDiagnosticsText([], (typeof window !== 'undefined' && window.__IWB_BUILD_META__) || {}),
|
||||
onExportDiag: () => exportRuntimeDiagnostics(),
|
||||
@@ -8159,6 +8170,7 @@ const tbCenterSeed = (type, refs) => {
|
||||
onDiagDetail: () => wDiagDetail(),
|
||||
// v3.26.136:合成层常驻提升开关(立即生效,改完看「进程实测」对比)
|
||||
onToggleLayers: (on) => { try { document.documentElement.dataset.layers = on ? 'on' : 'off'; lsSet('iwb_layers_on', !!on) } catch (e) { /* ignore */ } },
|
||||
onToggleCanvasV3: (on) => { try { if (window.IWBCanvasV3) window.IWBCanvasV3.setEnabled(!!on) } catch (e) { /* ignore */ } },
|
||||
onToggleNoBlur: (on) => { try { if (on) document.documentElement.dataset.noblur = 'on'; else delete document.documentElement.dataset.noblur; lsSet('iwb_noblur_on', !!on) } catch (e) { /* ignore */ } },
|
||||
}), document.body) : null,
|
||||
helpOpen ? ReactDOM.createPortal(el('div', { className: 'iwb-modal-mask', onWheel: (e) => e.stopPropagation(), onPointerDown: (e) => { if (e.target === e.currentTarget) setHelpOpen(false) } },
|
||||
|
||||
Reference in new issue
Block a user