Custom viewer interaction

Hello!

We are able to add custom interaction into our viewer with the api.addListener (and remove them) however we are adding them after a file was imported which takes time. If we try to add the interactions to the nodes while the viewer is busy the interaction won’t be applied to the specified outputNodes, since they are not yet created with a material. Is there a way to get an event for the viewer whenever it deblurs?

We are actually using a setTimeout() to make sure that they are correctly added but it’s not a very elegant solution. Using this weird workaround we often have too many listeners added in, is there a way to fetch added Listeners?

Thanks!

Hello @Antoine_Bouchard,

I just created a new page where all events are available, have a look here. In your case, the SESSION.SESSION_CUSTOMIZED event is probably what you are looking for.

I hope this solves your issue (and removes the need of setTimeout() :wink: )!

Cheers, Michael

Hello!

Thanks for the response, it did fix our problem at the time. However, we have new issues with the interactions, since for our application we need two viewers and two active sessions. We have hidden the sessions from the viewer that should not be displayed, this has worked fine so far: our left viewer does not display anything from our right session. Whenever we had interactions (api.addListener(INTERACTION.DRAG_END,…)), all interactable nodes from both sessions are draggable despite being hidden from the viewer. In our case, we cannot see the draggable nodes, but the click are registered to them and moved in the other viewer. So dragged events from the left viewer are registered in the right viewer and vice-versa.

I have spent some time trying to identify from which event or viewer are the event triggered but that was unsuccessful so any advice is welcome!

Thank you!

Hello @Antoine_Bouchard,

I will work on an example with two sessions/viewers and interactions. I’ll get back to you once I have that so that we can find out where the issue is.

Cheers, Michael

Hello @Antoine_Bouchard ,

I was able to reproduce some of your issues and fix them in 1.14.7.
Here is an example, please let me know if this solve your problem.

A small heads-up, we will focus on multiple viewers / multiple sessions in the next weeks as there are some things that are not as intuitive as they should be. (Settings, Lighting, etc.) I’ll let you know once these updates are rolled out.

Cheers, Michael

Hello!

Thanks for the quick response, I’ll update to 1.14.7 and check it out.
I’m not sure where to get the example, but I’m sure it’s great!

Thank you!

1 Like

@Antoine_Bouchard , forgot to send the link, here you go: multiple sessions - multiple viewers - interaction - CodeSandbox

1 Like