-
-
Notifications
You must be signed in to change notification settings - Fork 401
Description
RenderWindowInteractor (RWI) observes key events (keydown, keypress, keyup) on body.
For plain HTML app, it makes sense: If a key down event is not handled by any DOM element, then the key press event gets to the VTK view. That's handy.
However, React handles events AFTER native event listeners (addEventListener).
Therefore, onKeyDown callback gets called after the RWI. Calling stopPropagate() within the callback is therefore useless and will not prevent RWI from processing the event because it is already processed.
What do you suggest ?
- do native event listener within React (e.g.
addEventListener()incomponentDidMount()) - Make RWI stops listening
<body>but<container>instead ? - Delegate event listening to the framework (React, Vue...)
My understanding is that it is the same issue with Vue. I have not looked nor tried, but few weeks ago, I observed something similar in PVGlance. If you enable "the First Person mode" and use keydown/keyup to change the camera zoom factor, it also moves the camera forward in the view.