Skip to content

Fix mesh picking and rotation gizmo configuration#592

Closed
tracygardner wants to merge 1 commit intomainfrom
claude/fix-gizmo-mouse-interaction-ofXl6
Closed

Fix mesh picking and rotation gizmo configuration#592
tracygardner wants to merge 1 commit intomainfrom
claude/fix-gizmo-mouse-interaction-ofXl6

Conversation

@tracygardner
Copy link
Copy Markdown
Contributor

Summary

This PR addresses two issues in the gizmo interaction system: preventing duplicate mesh picking operations and correcting the rotation gizmo configuration.

Key Changes

  • Mesh Picking: Added an early return guard in pickMeshFromScene() to prevent starting keyboard mode if a mesh has already been picked, avoiding redundant picking operations
  • Rotation Gizmo: Removed the updateToMatchAttachedMesh: true option from configureRotationGizmo() call to use the default configuration behavior

Implementation Details

The mesh picking fix uses the existing hasPicked flag to short-circuit the keyboard mode initialization within the setTimeout callback, ensuring that only one picking operation occurs per user interaction. The rotation gizmo change simplifies the configuration by relying on default behavior rather than explicitly forcing mesh attachment updates.

https://claude.ai/code/session_01L3gkDE8aVzntgRGx76Ewwk

Two bugs:

1. Rotate gizmo: PR #583 added updateToMatchAttachedMesh: true to fix
   quaternion/Euler sync, but Babylon.js refuses to use local-space
   rotation on non-uniformly scaled meshes, logging a warning and
   breaking the gizmo after any resize. The quaternion-to-Euler
   conversion in rotDragEnd was the real fix for #582; revert the
   local-space option to restore rotation on all meshes.

2. Scale gizmo: pickMeshFromScene schedules startCanvasKeyboardMode in
   a setTimeout(0). If the user picks a mesh before that timer fires
   (e.g. via the GizmoManager's own pointer handler), the callback
   still runs, resetting the cursor to crosshair and re-enabling
   keyboard-pick mode on an already-selected mesh. Guard the callback
   with hasPicked so it is a no-op once picking has completed.

https://claude.ai/code/session_01L3gkDE8aVzntgRGx76Ewwk
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 30, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: ea038f26-3b1d-4260-9727-a40c91876118

📥 Commits

Reviewing files that changed from the base of the PR and between 2570145 and 00def41.

📒 Files selected for processing (1)
  • ui/gizmos.js

📝 Walkthrough

Walkthrough

Changes to ui/gizmos.js prevent deferred keyboard-mode picker setup from executing when a pick already occurred, eliminating double initialization. Additionally, rotation gizmo configuration now uses configureRotationGizmo defaults instead of forcing updateToMatchAttachedMesh: true.

Changes

Cohort / File(s) Summary
Gizmo picking and configuration
ui/gizmos.js
Added guard check in pickMeshFromScene to prevent deferred keyboard-mode picker initialization if a pick already occurred. Modified rotation gizmo setup to use default configuration instead of forcing updateToMatchAttachedMesh: true.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

Poem

🐰 A picker that picked just once with glee,
No double-init chaos here, you see!
Rotation gizmos now configured right,
Defaults shine through, oh what a sight! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Fix mesh picking and rotation gizmo configuration' directly and clearly summarizes the two main changes in the PR: fixing mesh picking behavior and rotation gizmo configuration.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/fix-gizmo-mouse-interaction-ofXl6

Warning

Review ran into problems

🔥 Problems

Timed out fetching pipeline failures after 30000ms


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.

❤️ Share
Review rate limit: 0/1 reviews remaining, refill in 60 minutes.

Comment @coderabbitai help to get the list of available commands and usage tips.

@tracygardner tracygardner deleted the claude/fix-gizmo-mouse-interaction-ofXl6 branch April 30, 2026 19:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants