Skip to content

Commit

Permalink
Wait for gltf-model to be loaded to show the selectionBox (#711)
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentfretin authored May 22, 2024
1 parent a633757 commit 4632f21
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/lib/viewport.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,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 4632f21

Please sign in to comment.