Closed Nancy-Salpepi closed 1 year ago
Typically the Restart Button restores one of two possible states
With PhET-iO this becomes a bit more complicated. When the Standard PhET-iO Wrapper is created, the current state becomes the state restored by the ResetAllButton, the scene reset button, and the Restart Button (at least until the user creates a new custom configuration).
I think there's a problem with how the Restart Button restores the saved configuration. It seems to always reset the time to zero, regardless of the time displayed when the saved configuration was created (this is true even in the 1.5 version). This seems like a bug to me.
Should both the Clear button and Restart buttons be disabled when the sim is launched?
The Clear button should be enabled if the displayed time is non-zero. In the video, pressing the scene reset button should have re-enabled the Clear button because it restores the state to 20 Earth Minutes.
If the sim is launched while paused, the Restart button should definitely be disabled, since the initial state should be identical to the what is restored by the Restart button. If this sim is playing, I would expect the button to only be disabled during the first frame, but once the objects start moving, the button would be enabled.
@marlitas and I reviewed the issue and summarized the recommendations:
@marlitas and I made good progress, and this issue is ready for cherry-picking.
Things look good in master and 1.6.0-rc.3. For:
The Restart Button should set time back to stored time (the time saved in state), not zero
In a phet-io saved state, the Restart button shouldn't set the time readout back to 0. It should be the time when the state was captured.
If I launch the sim after a certain amount of time has passed (or open saved version), press the clear button so time = 0, press Play and then press Restart, the time returns to 0 and not the time of the original. @samreid based on your https://github.com/phetsims/gravity-and-orbits/issues/455#issuecomment-1270005253 that sounds correct so I'm going to close this issue. If I'm wrong....I'm sorry and please reopen!
Yes, Restart is supposed to go to the beginning of the experiment, and not the stored PhET-iO initial state, so that sounds reasonable. Thanks!
There is one more TODO for this issue, see https://github.com/phetsims/gravity-and-orbits/blob/407291864f66b7e30b99202d0e3ee32c18ebead5/js/common/model/Body.ts#L232.
Fixed as @zepumph prescribed, it seemed straightforward. Closing.
Test device
Operating System MacBook Air (m1 chip)
Browser safari 16
Problem description For https://github.com/phetsims/qa/issues/838, in both Studio and State wrappers: In the launched sim, both the Restart button and Clear button are enabled. Pressing the Reset button next to the scene disables them.
Steps to reproduce
Should both the Clear button and Restart buttons be disabled when the sim is launched? This would prevent issues like the one reported by @KatieWoe in https://github.com/phetsims/gravity-and-orbits/issues/457
@arouinfar @samreid thoughts?
Visuals
https://user-images.githubusercontent.com/87318828/193315481-0dd235ac-ad25-48d0-a3d0-10d9f838d340.mp4