()
| 2553 | |
| 2554 | function handleGizmoDrag(axis, deltaDegrees) { |
| 2555 | if (!currentGeometry) return; |
| 2556 | |
| 2557 | // Accumulate the angle |
| 2558 | rotateAngles[axis] = ((rotateAngles[axis] || 0) + deltaDegrees) % 360; |
| 2559 | |
| 2560 | // Update input fields |
| 2561 | rotateXInput.value = Math.round(rotateAngles.x * 100) / 100; |
| 2562 | rotateYInput.value = Math.round(rotateAngles.y * 100) / 100; |
| 2563 | rotateZInput.value = Math.round(rotateAngles.z * 100) / 100; |
| 2564 | |
| 2565 | // Apply incremental rotation to geometry |
| 2566 | applyIncrementalRotation(axis, THREE.MathUtils.degToRad(deltaDegrees)); |
| 2567 | } |
| 2568 | |
| 2569 | function applyIncrementalRotation(axis, radians) { |
| 2570 | const quat = new THREE.Quaternion(); |
| 2571 | if (axis === 'x') quat.setFromAxisAngle(new THREE.Vector3(1, 0, 0), radians); |
| 2572 | else if (axis === 'y') quat.setFromAxisAngle(new THREE.Vector3(0, 1, 0), radians); |
| 2573 | else quat.setFromAxisAngle(new THREE.Vector3(0, 0, 1), radians); |
| 2574 | |
| 2575 | _rotateGeometry(quat); |
| 2576 | } |
| 2577 | |
| 2578 | function applyRotationFromInputs() { |
| 2579 | if (!currentGeometry) return; |
| 2580 | |
| 2581 | const targetX = parseFloat(rotateXInput.value) || 0; |
| 2582 | const targetY = parseFloat(rotateYInput.value) || 0; |
| 2583 | const targetZ = parseFloat(rotateZInput.value) || 0; |
no test coverage detected