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

Launched Sim doesn't reset to default temperature units #352

Closed
Tracked by #973
Nancy-Salpepi opened this issue Aug 16, 2023 · 5 comments
Closed
Tracked by #973

Launched Sim doesn't reset to default temperature units #352

Nancy-Salpepi opened this issue Aug 16, 2023 · 5 comments

Comments

@Nancy-Salpepi
Copy link

Test device
MacBook Air M1 chip

Operating System
13.5

Browser
Safari 16.6

Problem description
For phetsims/qa#970, the state of the default temperature units isn't working as it should. If a user changes the default units in the standard wrapper, pressing Reset All will restore the units to what the sim was launched in.

Steps to reproduce

  1. In Studio, press the Test button --> the standard wrapper will open with Celsius as the default temperature.
  2. In the preferences menu of the standard wrapper, change the default units to K.
  3. Go to any screen--> the temperature units will be in K
  4. Press Reset All --> temperature units go back to Celsius even though default is Kelvin.

Visuals

defaultTempUnits.mp4
@jbphet
Copy link
Contributor

jbphet commented Aug 17, 2023

This might actually be the correct behavior. When a sim is launched from Studio like this, a reset is supposed to restore the state as it was when the sim was launched and not the completely unmodified state.

@arouinfar - My guess is that we've never thought about how reset should work for a global setting like this. I'd like to pass this off to you for consideration. It does strike me as a little weird that a global value is being reset in this way, but I think it's probably how the phet-io post-studio-launch reset works under the hood.

@jbphet jbphet assigned arouinfar and unassigned jbphet Aug 17, 2023
@arouinfar
Copy link
Contributor

When a sim is launched from Studio like this, a reset is supposed to restore the state as it was when the sim was launched and not the completely unmodified state.

This is true. However, controls in the Preferences menu are not supposed to be overridden by the ResetAllButton, either. If a client doesn't want students to make changes to the Preferences, they can hide the tabs or individual controls on the SImulation tab.

I would expect that changes to Preferences after the sim is launched (e.g. enabling Interactive Highlights) should remain when the sim is reset. I think the same applies to the controls under the Simulation tab. This is how things are handled in Geometric Optics and Calculus Grapher.

@arouinfar arouinfar assigned jbphet and unassigned arouinfar Aug 17, 2023
@jbphet
Copy link
Contributor

jbphet commented Aug 18, 2023

@samreid looked at this with me, and we realized that the situation here is a bit unique versus that of Geometric Optics and Calculus Grapher. In those sims, the value set in the Preferences dialog is used in the various screens and there is no way to deviate from the preferences in the screens. In Greenhouse the value for temperature units is a default that can be changed on each of the screens. Each of the screens therefore has its own state variable for the temperature units, and that is what is being restored on a reset in a standard wrapper. The solution that we came up with is to set the temperature units to the default value after phet-io state has finished updating.

@jbphet
Copy link
Contributor

jbphet commented Aug 22, 2023

QA - Feel free to close once verified.

@Nancy-Salpepi
Copy link
Author

This looks good in rc.1!

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

3 participants