Skip to content

Commit

Permalink
#728 Make template instance not selectable in 3D Viewer
Browse files Browse the repository at this point in the history
  • Loading branch information
jrmartin committed Jul 2, 2021
1 parent 8723fe6 commit d55caea
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion components/VFBMain.js
Original file line number Diff line number Diff line change
Expand Up @@ -1058,7 +1058,7 @@ class VFBMain extends React.Component {
if ( nextProps.generals.instanceOnFocus !== undefined && this.instanceOnFocus !== undefined) {
if ( Object.keys(nextProps.generals.instanceOnFocus).length > 0 ) {
if ( nextProps.generals.instanceOnFocus !== this.instanceOnFocus.getId() ){
this.instanceOnFocus == nextProps.generals.instanceOnFocus;
this.instanceOnFocus = nextProps.generals.instanceOnFocus;
}
}
}
Expand Down Expand Up @@ -1380,6 +1380,13 @@ class VFBMain extends React.Component {
GEPPETTO.on(GEPPETTO.Events.Instance_added, function (instance) {
that.props.instanceAdded(instance);
});

GEPPETTO.on(GEPPETTO.Events.Instances_created, function (instances) {
// Set template Instance to be not clickable in 3D viewer
if ( instances[0]?.id?.includes(window.templateID) ) {
that.canvasReference.engine.meshes ? that.canvasReference.engine.meshes[window.templateID + "." + instances[0]?.id].children[0].clickThrough = true : null;
}
});

GEPPETTO.on(GEPPETTO.Events.Instance_deleted, function (instancePath) {
let id = instancePath.split(".")[0];
Expand Down

0 comments on commit d55caea

Please sign in to comment.