Open jessegreenberg opened 1 month ago
For the reviewer:
demoRichDragListeners
.phet-info/alternative-input-quickstart-guide.md
Over slack @zepumph mentioned he can do this (and thank you!). @zepumph if that doesn't work anymore let me know and I will find another.
@jessegreenberg and I had a sync conversation that went well. I communicated my initial feedback and I believe he will paste in notes at some point for next steps. Back to him.
@zepumph reviewed and we met on zoom to discuss next steps.
providedOptions
. Consider renaming options so it is clear which listener they are for. We want to consult other developers about this before committing to it. But start to consider how this pattern could be implemented.We also discussed:
RichDragListener has been moved to scenery, but here is a patch with changes to scenery-phet that refactor the sound related code. I am happy with the de-duplication but there are still ts-expect-error
s in places where I couldn't figure out how to abstract types.
OK, summarizing the above commits:
RichDragListener
was moved to scenery. It combines a KeyboardDragListener
and a DragListener
.SoundRichDragListener
was added to scenery-phet that adds sounds into a RichDragListener
.RichPointerDragListener
was renamed to SoundDragListener
.RichKeyboardDragListener
was renamed to SoundKeyboardDragListener
.SoundDragListener
and SoundKeyboardDragListener
pull the implementation from SoundRichDragListener
to de-duplicate code.RichDragListener
exposes each type of listener.For these parts:
We are interested in making the API simpler by making it so that you ahve to use listener specific options less frequently. Consider how we can pass all options to the top level providedOptions
I don't think that makes the API simpler yet and I prefer the way it is structured now. Would be good to discuss again before working on this more.
alternatively, just delete these and these listeners will be availabel through SoundRichDragListener
I think there is going to be a lot of use cases for SoundDragListener
and possibly SoundKeyboardDragListener
, giving them their own classes seems most intuitive for other developers so I decided to leave these classes as they are.
Sorry it has been a while @zepumph, but would you mind re-reviewing these changes from what we discussed in https://github.com/phetsims/scenery-phet/issues/858#issuecomment-2153518978?
I'm a big fan of these changes. Thanks for all your hard work. I updated some of the typing so that more could be shared. I'd worry about the RichDragListener options getting out of date. I have a couple of TODOs pointing to this issue for you to look at, and help review my changes. Let me know what you think. To be clear, everything I did was with Typescript types, not runtime values. The implementation looks great.
In https://github.com/phetsims/scenery/issues/1614 we created a combined listener that supports both pointer and keyboard dragging. The listener is in scenery-phet because it also supports sounds from tambo (see #849).
This would benefit from a code review. In particular