From 00def4123fcfc557d3e32347363ee35b008f0d5c Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 30 Apr 2026 12:16:27 +0000 Subject: [PATCH] Fix scale and rotate gizmo mouse interaction 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 --- ui/gizmos.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ui/gizmos.js b/ui/gizmos.js index 07b0b8fe..8c7d06e0 100644 --- a/ui/gizmos.js +++ b/ui/gizmos.js @@ -789,6 +789,7 @@ function pickMeshFromScene(onPicked, persistent = false) { activePick = { pointerObservable, pointerObserver }; setTimeout(() => { + if (hasPicked) return; startCanvasKeyboardMode( (x, y) => { const pick = flock.scene.pick(x, y); @@ -1379,7 +1380,7 @@ function handleScaleGizmo() { // Rotation: Allow the user to rotate the mesh by dragging it function handleRotationGizmo() { - configureRotationGizmo(gizmoManager, { updateToMatchAttachedMesh: true }); + configureRotationGizmo(gizmoManager); // Show that rotation is active const rotationButton = document.getElementById("rotationButton");