Skip to content

Commit e23ba11

Browse files
authored
Merge pull request #164 from jgphilpott/copilot/fix-gizmo-visibility-issue
fix: restore gizmo visibility on first model click
2 parents 3875a70 + a92936b commit e23ba11

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

examples/visualizer/visualizer.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -241,9 +241,11 @@ function initTransformControls() {
241241
pointer.y = -((event.clientY - rect.top) / rect.height) * 2 + 1;
242242
raycaster.setFromCamera(pointer, camera);
243243

244-
// If the click lands on the gizmo arc handles, do not dismiss it.
245-
const gizmoHits = raycaster.intersectObject(transformControls.getHelper(), true);
246-
if (gizmoHits.length > 0) return;
244+
// If the gizmo is attached and the click lands on the arc handles, do not dismiss it.
245+
if (transformControls.object) {
246+
const gizmoHits = raycaster.intersectObject(transformControls.getHelper(), true);
247+
if (gizmoHits.length > 0) return;
248+
}
247249

248250
const hits = raycaster.intersectObject(meshObject, true);
249251
if (hits.length > 0) {

0 commit comments

Comments
 (0)