phetsims/neuron

Use TimeControlNode for Play/Pause/Step buttons

Closed this issue · 6 comments

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.

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.

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.

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?

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.

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

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.