fix(canvas): 停靠栏未就绪时不落盘视口(修 6 条 e2e 超时)+ 4 条用例按现 UI 修正
根因(trace 定位,6 条同一原因): 首页视图里启动 fit 早于停靠栏挂载(--iwb-dock-l 首帧为空)⇒ 算出 ins=0 的坏视口 (实测 translate(-92,-84));这份坏值被 useViewportPersistence 落盘,打开画布时又被当作 「用户保存的视口」恢复 ⇒ 节点停在 x=29(压在 318px 左栏下),dblclick 命中浏览器面板的 .iwb-cwv-url / .iwb-cwv-empty,Playwright 重试到 30s 超时。 修法:flushViewport 增加 insetsReady 门槛(--iwb-dock-l 为空串时跳过落盘); 画布打开后 loadWsInto 走 doFit,此时占位就绪,落盘的是正确视口。 4 条用例按现 UI 修正: - tooltip-labels ②:单选气泡现为 改名/复制/删除/添加到提示词库…(收藏只在多选气泡) - image-original:收藏入口已收进「选中操作 ▸」子菜单(且需先选中节点) - resume-scope:运行入口已收进「该节点 ▸」子菜单 - download-cors:同源代理 /api/img 已随网页版删除,桌面走原生 HTTP 另存为 ⇒ 该条标 fixme(需 Tauri 环境) 验证: - 组 A(typing-perf / storage-incremental / close-flush / history-sweep)6/6 绿 - 组 B(image-original / resize-perf / tooltip-labels / resume-scope / download-cors)12/12 绿 - verify:ci 全绿(facts 数字已 sync) - 已知红基线 17 → 7 条(只剩 clipboard-audit 3 + image-memory-parity 4,均为环境限制)
This commit is contained in:
1 parent
e6f147ac4b
commit
8035c01fb7
7 files changed
+34
-86
No files matched your search
@@ -28,8 +28,17 @@
|
||||
const mountedRef = useRef(false) // 首次 effect 运行 = 还没发生任何视口变化
|
||||
const userRef = useRef(false) // 发生过「适应视图 / 用户平移缩放」才算真实视口
|
||||
let flushCache = null
|
||||
// 2026-11-27:停靠栏还没挂载时(--iwb-dock-l 为空串)算出来的视口是「ins=0 的坏值」,
|
||||
// 不能落盘 —— 否则打开画布时会被当成用户保存的视口恢复,节点永远压在侧栏底下。
|
||||
const insetsReady = () => {
|
||||
try {
|
||||
if (typeof global.getComputedStyle !== 'function' || !global.document) return false
|
||||
return String(global.getComputedStyle(global.document.documentElement).getPropertyValue('--iwb-dock-l') || '').trim() !== ''
|
||||
} catch (e) { return false }
|
||||
}
|
||||
const flushViewport = () => {
|
||||
if (!userRef.current) return
|
||||
if (!insetsReady()) return
|
||||
const v = viewportRef.current, ws = activeWsRef.current
|
||||
try {
|
||||
const st = (typeof global.IWBStorageLocal !== 'undefined' && global.IWBStorageLocal.getStore) ? global.IWBStorageLocal.getStore() : null
|
||||
|
||||
Reference in new issue
Block a user