| 932 | depthTest: !xray, |
| 933 | polygonOffset: !xray, |
| 934 | polygonOffsetFactor: -1, |
| 935 | polygonOffsetUnits: -1, |
| 936 | }); |
| 937 | const mesh = new THREE.Mesh(overlayGeo, mat); |
| 938 | mesh.renderOrder = 1; |
| 939 | _diagFaces.push(mesh); |
| 940 | scene.add(mesh); |
| 941 | requestRender(); |
| 942 | } |
| 943 | |
| 944 | // ── Rotation Gizmo ─────────────────────────────────────────────────────────── |
| 945 | |
| 946 | let _rotGizmoGroup = null; // THREE.Group holding the 3 rings |
| 947 | let _rotGizmoVisible = false; |
| 948 | let _rotGizmoDragging = null; // { axis: 'x'|'y'|'z', startAngle, startPointer } |
| 949 | let _rotGizmoCallback = null; // function(axis, deltaDegreesIncremental) called during drag |
| 950 | const _gizmoRaycaster = new THREE.Raycaster(); |
| 951 | const GIZMO_COLORS = { x: 0xff3333, y: 0x33dd55, z: 0x4488ff }; |
| 952 | const GIZMO_HOVER_COLORS = { x: 0xff8888, y: 0x88ff99, z: 0x88bbff }; |
| 953 | |
| 954 | function _buildRotGizmo() { |
| 955 | if (_rotGizmoGroup) return; |
| 956 | _rotGizmoGroup = new THREE.Group(); |
| 957 | _rotGizmoGroup.renderOrder = 100; |
| 958 | |
| 959 | const createRing = (axis, color) => { |
| 960 | // Visible ring |
| 961 | const geo = new THREE.TorusGeometry(1, 0.02, 12, 64); |
| 962 | const mat = new THREE.MeshBasicMaterial({ |
| 963 | color, |