Skip to content

Commit

Permalink
Wait for gltf-model to be loaded to show the selectionBox
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentfretin committed May 31, 2024
1 parent 9457cda commit 410ba27
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/editor/lib/viewport.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,15 @@ export function Viewport(inspector) {
if (object.el.getObject3D('mesh')) {
selectionBox.setFromObject(object);
selectionBox.visible = true;
} else if (object.el.hasAttribute('gltf-model')) {
object.el.addEventListener(
'model-loaded',
() => {
selectionBox.setFromObject(object);
selectionBox.visible = true;
},
{ once: true }
);
}

transformControls.attach(object);
Expand Down

0 comments on commit 410ba27

Please sign in to comment.