fix: v3.26.163 松手同帧强制重绘边线(进一步消掉旧连线残留)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 1m14s
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 1m14s
This commit is contained in:
1 parent
37369d1145
commit
0617eb7b14
5 files changed
+26
-5
No files matched your search
@@ -7405,7 +7405,7 @@ const tbCenterSeed = (type, refs) => {
|
||||
if (typeof refs.edgeCanvasDraw === 'function') refs.edgeCanvasDraw(vp.x, vp.y, vp.scale)
|
||||
}
|
||||
} catch (e3) { /* ignore */ }
|
||||
}, 140)
|
||||
}, 60)
|
||||
}
|
||||
|
||||
const applyViewportDom = (x, y, scale) => {
|
||||
@@ -7442,6 +7442,27 @@ const tbCenterSeed = (type, refs) => {
|
||||
}
|
||||
}
|
||||
|
||||
// v3.26.163:松手后立刻重绘边线(同帧 + 下一帧各一次)——
|
||||
// 之前只靠 140ms 定时器 + React 提交,重负载时旧连线会滞留到下一次渲染(体感约 1 秒)。
|
||||
React.useEffect(() => {
|
||||
const flush = () => {
|
||||
const el = canvasEl && canvasEl.el
|
||||
if (!el || !el.querySelector) return
|
||||
const cv = el.querySelector('.iwb-edge-canvas')
|
||||
if (cv) cv.style.transform = ''
|
||||
const vp = refs.lastViewport || refs.viewportLive || refs.viewport || { x: 0, y: 0, scale: 1 }
|
||||
try { if (typeof refs.edgeCanvasDraw === 'function') refs.edgeCanvasDraw(vp.x, vp.y, vp.scale) } catch (e) { /* ignore */ }
|
||||
try { CanvasGeometry.applyEdgeLayerDom(el, canvasSize, vp.x, vp.y, vp.scale) } catch (e2) { /* ignore */ }
|
||||
}
|
||||
const onUp = () => { flush(); requestAnimationFrame(flush) }
|
||||
window.addEventListener('pointerup', onUp, true)
|
||||
window.addEventListener('pointercancel', onUp, true)
|
||||
return () => {
|
||||
window.removeEventListener('pointerup', onUp, true)
|
||||
window.removeEventListener('pointercancel', onUp, true)
|
||||
}
|
||||
}, [canvasSize.w, canvasSize.h])
|
||||
|
||||
// LOD 滞回状态:plain 在 <15% 进入、>18% 退出(用 ref 保存,不触发额外渲染)
|
||||
if (refs.lodPlain === undefined) refs.lodPlain = false
|
||||
if (!refs.lodPlain && viewport.scale < 0.15) refs.lodPlain = true
|
||||
|
||||
Reference in new issue
Block a user