Stabilize gizmo mesh picking and keyboard handlers; fix event listener options#574
Stabilize gizmo mesh picking and keyboard handlers; fix event listener options#574tracygardner wants to merge 1 commit intomainfrom
Conversation
|
Caution Review failedPull request was closed or merged during review 📝 WalkthroughWalkthroughTwo files updated: axis-keyboard.js fixes event listener deregistration by including the correct capture flag to match registration; gizmos.js refactors pick handling deduplication, keyboard-move activation tracking, and mesh attachment normalization to eliminate redundant operations. Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Deploying flockxr with
|
| Latest commit: |
90232a7
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://d35d9b5c.flockxr.pages.dev |
| Branch Preview URL: | https://codex-fix-double-movement-on.flockxr.pages.dev |
Motivation
pickMeshFromSceneor canvas keyboard picking.removeEventListeneruses the same options as the correspondingaddEventListenerto reliably unregister the handler.Description
ui/axis-keyboard.jsupdatestop()to calldocument.removeEventListener("keydown", handler, true)so the removal matches the capturing listener registration.ui/gizmos.jsaddhasPickedand ahandlePickedwrapper insidepickMeshFromSceneto ensure non-persistent picks only trigger once and to centralize cleanup behavior.keyboardAttachedMeshandactivatePositionKeyboardForMesh()to avoid reattaching the keyboard handler when the same mesh is reselected and to centralize block highlighting.activatePositionKeyboardForMesh()for the currently attached mesh and to usegetRootMeshwhen picking child meshes.setGizmoManagernormalize incoming meshes by resolving to the root usinggetRootMesh(mesh.parent)when appropriate and return early if the requested mesh is already attached to avoid redundant work.Deletekey (keyCode46) for mesh deletion (handler body shown partially in diff).Testing
npm test, and the tests completed successfully.npm run lintand performed a production build withnpm run build, and both succeeded.Codex Task
Summary by CodeRabbit
Bug Fixes