Skip to content
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

Inconsistent availability of buttons #459

Closed
Tracked by #841
Nancy-Salpepi opened this issue Sep 30, 2022 · 7 comments
Closed
Tracked by #841

Inconsistent availability of buttons #459

Nancy-Salpepi opened this issue Sep 30, 2022 · 7 comments

Comments

@Nancy-Salpepi
Copy link

Test device

Operating System
MacBook Air (m1 chip)

Browser
safari 16

Problem description
For phetsims/qa#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

  1. In the State wrapper set state rate= 0
  2. On either screen, press Play
  3. Pause after some time has passed
  4. Launch sim--buttons are enabled
  5. Press Reset button--buttons are disabled
  6. Press Reset All button--buttons are enabled

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 #457

@arouinfar @samreid thoughts?

Visuals

state.of.buttons.mp4
@arouinfar
Copy link
Contributor

Typically the Restart Button restores one of two possible states

  1. The default configuration of the scene (if no custom configuration exists). This is identical in function to the scene reset button.
  2. A custom configuration created while the sim was paused

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.

@arouinfar arouinfar removed their assignment Oct 4, 2022
@samreid
Copy link
Member

samreid commented Oct 5, 2022

@marlitas and I reviewed the issue and summarized the recommendations:

  • The Restart Button should set time back to stored time (the time saved in state), not zero.
  • The Clear button should be enabled if the displayed time is non-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 the sim is launched while paused, the Restart button should definitely be disabled,

@samreid samreid changed the title Inconsistant availability of buttons Inconsistent availability of buttons Oct 5, 2022
samreid added a commit that referenced this issue Oct 5, 2022
@samreid
Copy link
Member

samreid commented Oct 5, 2022

@marlitas and I made good progress, and this issue is ready for cherry-picking.

@Nancy-Salpepi
Copy link
Author

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 #455 (comment) that sounds correct so I'm going to close this issue. If I'm wrong....I'm sorry and please reopen!

@samreid
Copy link
Member

samreid commented Oct 6, 2022

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!

@zepumph
Copy link
Member

zepumph commented Jan 16, 2023

There is one more TODO for this issue, see

// TODO: Note there is something in model.changeRewindValueProperty that duplicates this work
.

From phetsims/chipper#1372

@samreid
Copy link
Member

samreid commented Feb 10, 2023

Fixed as @zepumph prescribed, it seemed straightforward. Closing.

@samreid samreid closed this as completed Feb 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants