phetsims / scenery

Scenery is an HTML5 scene graph.
MIT License
53 stars 12 forks source link

Use KeyStateTracker in KeyboardDragListener #1054

Closed jessegreenberg closed 6 months ago

jessegreenberg commented 4 years ago

KeyStateTracker was created to manage the state of the keyboard generally, but it was never applied to KeyboardDragListener. We should do that now.

We discussed using the global KeyStateTracker (currently on the Display), but decided against that because there is no guarantee that it will be up to date by the time we receive keyboard events in that listener. So KeyboardDragListener should have its own KeyStateTracker that it updates at the beginning of its keydown and keyup listeners so that the KeyStateTracker is up to date.

We also mentioned that AccessibleValueHandler could benefit form using KeyStateTracker, but not sure if it is worthwhile (time, and KeyStateTracker is heavy for what what it would provide). After this issue we can decide if it should be used there.

I am going to work on this as part of #1053. Also, this issue came from work in https://github.com/phetsims/scenery/issues/850 (it initial creation), https://github.com/phetsims/scenery/issues/913 (its movement to scenery) https://github.com/phetsims/scenery/issues/909 (used in scenery PDOMPointer).

jessegreenberg commented 4 years ago

Giving medium priority to match #1053.

jessegreenberg commented 6 months ago

This can be closed and replaced with https://github.com/phetsims/scenery/issues/1570. We don't want to use KeyStateTracker in KeyboardDragListener, we want to use KeyboardListener.

phet-dev commented 6 months ago

Reopening because there is a TODO marked for this issue.