GaussianSplats3D icon indicating copy to clipboard operation
GaussianSplats3D copied to clipboard

Add option: listenToKeyEvents

Open hirako2000 opened this issue 1 year ago • 1 comments

Motivation and Context

Solves #409

  • useBuiltInControls binds mouse/drag and also keydown events
  • Applies the keydown listener to the entire window

The problem with this, is that enabling built in controls bulk enables all supported forms of controls, and the fact it applies it to the window context makes potential input elements being hijacked their ability to receive keydown events. Typically a textarea or text input would receive most key downs, except those caught by the viewer element.

Ideally another parameter shall be added, a dom element to apply the listener to. Applying it to the entire window is a bug, this PR does not address that, merely works around the issue by providing more granularity, allowing to keep non key down events and disabling keydowns. It is likely common for users to desire mouse/drag abilities, but not mind about the keyboard controls.

Description

Updates logic and README with listenToKeyEvents

  • Adds listenToKeyEvents option and conditionals
  • Defaulting to true to maintain existing behavior
  • Binds and add lister if listenToKeyEvents is true

The changeset is backward compatible.

Steps to verify

Checkout the branch, using the demo:

-> Mouse, Drag, and key input should work.

Then also check:

  • Set listenToKeyEvents to false
  • Keep useBuiltInControls as is

-> The mouse/drag input should still work, but key events shall do nothing

hirako2000 avatar Mar 10 '25 11:03 hirako2000

any info ?

igun997 avatar Oct 02 '25 14:10 igun997