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);