phetsims / collision-lab

"Collision Lab" is an educational simulation in HTML5, by PhET Interactive Simulations.
GNU General Public License v3.0
6 stars 4 forks source link

Dragging or altering balls sometimes pauses sim #201

Closed KatieWoe closed 3 years ago

KatieWoe commented 3 years ago

Device iPad 6th Gen OS iPadOS 14.3 Browser Safari Problem Description For https://github.com/phetsims/QA/issues/599. Sometimes, when dragging a ball or changing its mass/velocity when the sim is running, the sim pauses when you are finished, rather than resuming as it normally does. It seems this occurs if the sim is running one of the pre-set experiments on the inelastic screen. Steps to Reproduce

  1. Go to the Inelastic screen
  2. Select one of the preset setups
  3. Press play
  4. While playing, grab one of the balls and move it

Visuals

https://user-images.githubusercontent.com/41024075/105544245-fab70100-5cb7-11eb-9ce6-b593c82825a4.MP4

KatieWoe commented 3 years ago

This may be happening due to the fact that the sim seems to pause when you switch between presets and/or custom. Making one of these changes moves from a preset to custom.

jonathanolson commented 3 years ago

@arouinfar what is the general desired behavior here?

arouinfar commented 3 years ago

Perhaps things stay paused because the velocity is zero? The PlayPauseButton should only temporarily flip to the paused state when dragging the balls. In this case, the PlayPauseButton should display pause after the ball is released because that was the state of the button before it the ball was grabbed.

jonathanolson commented 3 years ago

This seems to be intentionally happening in this specific case:

 * In the 'Inelastic' screen, there are different 'presets' of Balls. When the user changes a the preset,
 * InelasticBallSystem will do the following:
 *   - Pause the sim.
 *   - Set the elapsed time to 0.
 *   - Set every Ball's position, mass, and velocity to the preset's BallStates, if the preset is not set to CUSTOM.
 *     Setting the preset to CUSTOM doesn't change any of the Balls.
 *   - If the user manipulates any of the two Balls, the preset is set to CUSTOM.

This seems to be happening because it's switching from a preset to the "custom" preset. Do we want to maintain the "when the user clicks on a different preset, including switching to custom, the sim always pauses"? So it would only be an auto-switch to custom which wouldn't pause?

jonathanolson commented 3 years ago

I implemented my suggestion above, let me know how it seems.

arouinfar commented 3 years ago

Thanks for the explanation @jonathanolson. I think the behavior in master feels much more natural, so let's stick with that. Back to you for next steps.

KatieWoe commented 3 years ago

This looks good in rc.2