Skip to content

RWI keypress event listener #1856

@finetjul

Description

@finetjul

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 ?

  1. do native event listener within React (e.g. addEventListener() in componentDidMount())
  2. Make RWI stops listening <body> but <container> instead ?
  3. 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.

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions