phetsims / neuron

"Neuron" is an educational simulation in HTML5, by PhET Interactive Simulations.
GNU General Public License v3.0
1 stars 3 forks source link

Use TimeControlNode for Play/Pause/Step buttons #142

Closed jessegreenberg closed 4 years ago

jessegreenberg commented 4 years ago

From phetsims/scenery-phet#561. A scenery-phet/TimeControlNode was created that combines the PlayPauseButton and StepForwardButton and includes PhET-iO and PDOM instrumentation. It should be used in this sim. Assigning to responsible dev.

SaurabhTotey commented 4 years ago

This one is proving tricky to me. The step back button has special conditions for when it is disabled, and I am unable to control the step back button of a TimeControlNode. I will spend some more time investigating if this is something that can be worked around.

jessegreenberg commented 4 years ago

Thanks @SaurabhTotey, it doesn't look like TimeControlNode would easily support this currently. Maybe we need to modify TimeControlNode so that this is possible.

Please feel free to make an issue in scenery-phet and assign to me if you agree.

jessegreenberg commented 4 years ago

Actually, we may just need to remove the recently added assertion that each button of the TimeControlNode use the same isPlayingProperty. @SaurabhTotey if you could pass a different Property to the StepBackButton would that be sufficient for this?

SaurabhTotey commented 4 years ago

I believe that being able to pass a different isPlayingProperty to each constituent StepButton would indeed be sufficient to implement the behaviour used in this sim.

jessegreenberg commented 4 years ago

@SaurabhTotey I removed these assertions so you can use a custom isPlayingProperty for the StepButton. Let me know if there are other issues.

SaurabhTotey commented 4 years ago

Thanks @jessegreenberg! I migrated NeuronScreenView to use TimeControlNode. I had to change the previous stepBackEnabledProperty to a stepBackDisabledProperty and then pass that in as the isPlayingProperty for the StepBackwardButton. It seemed a bit odd to me that an isPlayingProperty was getting passed a stepBackDisabledProperty, so I put a comment above stepBackDisabledProperty explaining the reasoning.

I will close this issue, but please let me know if there is anything I left out or if there is anything else I should do.