Multiple render windows for vtkWasm

Hi Guys

I have a working setup using two vtkWebAssembly....Windows. It is super nasty. I stop and resume the message loop when the mouse enters a window. Here, I set all interactors to nullptr and set my interactor to the current window and perform some resize of the window and interactor.

It is an anti-pattern.

My question:

I will need to implement this feature and would like your feedback on my proposed design. My idea is to allow multiple windows with multiple interactors but behind the scene there is only one interactor received message and forwards them to a bunch of passive interactors (the ones that the user assigns to a window or a widget). When processing the events, I will investigate if the events lie within a canvas and use this for forwarding the interactor. I would probably also need to inject some events if the user holds the mouse button and moves from one window to another.

Another option would be to install a timer (executing in the host thread) and empty a queue with a high frequency.

Any recommendations and idea are appreciated

Jens Munk

A simple solution is to use vtkGenericRenderWindowInteractor and translate all events from JavaScript to VTK style events. Also, one needs to listen to CreateTimerEvent and DestroyTimerEvent. To do all this one needs to wrap VTK functionality to JavaScript using Emscripten.