From 36aa0c802ef2fac4e85797ec7d32538a8d9a4874 Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Wed, 20 May 2026 20:50:41 +0000 Subject: [PATCH] Changes Co-authored-by: Reifonas <211114984+Reifonas@users.noreply.github.com> --- src/components/three/ModelViewer.tsx | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/components/three/ModelViewer.tsx b/src/components/three/ModelViewer.tsx index 8725376..2a1061e 100644 --- a/src/components/three/ModelViewer.tsx +++ b/src/components/three/ModelViewer.tsx @@ -596,8 +596,25 @@ function PositionDragHandler() { rotX: ft.rotX + dy * sens, }); } - } else if (button === 1 || (button === 0 && shiftKey)) { - // Middle or Shift+left: depth (Z in camera space) + } else if (button === 1) { + // Middle button (wheel): roll around the piece's own longitudinal axis + const sens = 0.5; + let dominant: 'x' | 'y' | 'z' = 'x'; + scene.traverse((o) => { + if (o.userData?.modelId === active.id && o.userData?.dominantAxis) { + dominant = o.userData.dominantAxis; + } + }); + const delta = dx * sens; + if (dominant === 'x') { + useModelStore.getState().setFineTuning({ rotX: ft.rotX + delta }); + } else if (dominant === 'y') { + useModelStore.getState().setFineTuning({ rotY: ft.rotY + delta }); + } else { + useModelStore.getState().setFineTuning({ rotZ: ft.rotZ + delta }); + } + } else if (button === 0 && shiftKey) { + // Shift+left: depth (Z in camera space) const worldDelta = dy * pixelsPerWorldUnit; const camDir = new THREE.Vector3(); camera.getWorldDirection(camDir);