-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a way to listen for Slider drag events #561
Comments
Yep, sounds appropriate to me (no pun intended :) |
Added in the commit. @pixelzoom would you like to review? |
The doc for option
Shouldn't it say something about when it's called on drag? That would be expected for "hook" documentation. Looks like it's called first, before any other drag work happens. |
I added documentation, ready for review. |
👍 closing. |
While looking at phetsims/wave-interference#484 I was curious as to why we decided to call drag first. Can you clarify? Looking around at other usages of "callbacks" on the project make me feel like it makes more sense to call it at the very end, after the Property has been updated. I see callbacks called last in PressListener, and SimpleDragListener, and KeyboardDragListener. const mySlider = new Slider( myProperty, {
drag: ()=>{ console.log( myProperty.value, 'value for this drag event' ); }
} ); This code is not logging the right value, currently. Note, I was surprised to see that |
I marked this as blocking for Waves Intro |
#561 (comment) Makes sense to me.
I was trying to match the behavior of Slider in AccessibleValueHandler, if the callback moves in Slider.js it should move in the AccessibleValueHandler trait as well. |
We discussed this yesterday during developer meeting and agreed that the optional drag callback should be moved to after the Property value is set. |
The optional callback was moved, @samreid can you please review? |
Oh and I should mention that WaveInterferenceSlider was the only place I could find that used the |
I reviewed the change and tested in Wave Interference and it is working nicely, thanks! Closing. |
As part of phetsims/wave-interference#468 we are adding discrete slider clicking sounds to Wave Interference. The demonstration for this in tambo wires up listeners to the Properties directly,
However, I recall a conversation where we agreed that we would couple the sounds to the user interface events directly, rather than going through the controlled Property instances. It looks like Slider has options for
startDrag
andendDrag
but not fordrag
. In order to power the sound events by user interface events, we will need a way to listen todrag
.@pixelzoom does this sound appropriate to you? Should we add
options.drag
to Slider?The text was updated successfully, but these errors were encountered: