修复 UI 编辑器返回后资源画布平移 #356
Reference in New Issue
Block a user
Delete Branch "fix/cant-pan-after-ui-editor"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
资源管理卸载重挂时重新绑定画布 wheel 监听
closes #349
修复方向正确,已验证:
验证过程
uiEditorRoute非空时(7125 行分支)整个资源 manager 子树卸载,返回后resourceBookManagerRef指向新 DOM 节点,而 wheel effect 原依赖只有handleResourceBookWheel与mode,不会重跑,监听滞留在已脱离文档的旧节点上。把uiEditorRoute加入依赖后,进出编辑器都会先清理旧节点再绑定新节点;effect 在 commit 之后运行,ref 已就位,修复成立。uiEditorRoute作为依赖,这次只是补齐遗漏的一处。npx vitest run apps/ai-game-creator-shell/tests/appSurface.test.ts -t "restores resource canvas panning"在 PR 分支通过;把uiEditorRoute从依赖里临时去掉后用例如期失败(defaultPrevented为 false),说明用例确实钉住了这个回归。一个非阻塞的后续项
同一文件中 3526 行的 effect 把
wheel/gesturestart/gesturechange/gestureend绑在resourceCanvasRef.current(同在 manager 子树内,7143 行之下),依赖数组同样没有uiEditorRoute。进出一次 UI 编辑器后,这些监听同样滞留在旧节点上:ctrl/⌘+滚轮的板块缩放与 macOS Safari 的捏合手势(gesture* 只在 canvas 层登记)会在返回后失效,且该 effect 的依赖不会因平移/缩放自愈。不属于本 PR 报告范围(#349 只提平移),不阻塞合并;建议顺手补一行依赖或记为后续 issue。经过测ctrl+ scoll正常