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

Mass changes when pressing Restart #328

Closed
Tracked by #1029
Nancy-Salpepi opened this issue Jan 4, 2024 · 6 comments
Closed
Tracked by #1029

Mass changes when pressing Restart #328

Nancy-Salpepi opened this issue Jan 4, 2024 · 6 comments
Assignees
Labels

Comments

@Nancy-Salpepi
Copy link

Nancy-Salpepi commented Jan 4, 2024

Test device
MacBook Air M1 chip

Operating System
14.1.2

Browser
FireFox/Chrome/Safari

Problem description
For phetsims/qa#1015, if the mass of a body is changed with the increment/decrement buttons when the sim is playing, pressing Restart changes the mass value by 1. This is only seen if the button is pressed repeatedly --not seen if you press and hold or if you use the slider.

EDIT: Actually the sim doesn't need to be playing initially for this to happen.

Steps to reproduce

  1. On either screen press Play
  2. Change the mass of body 1 by repeatedly pressing the increment button a few times
  3. Press restart

Visuals

massChanges.mp4
@Nancy-Salpepi Nancy-Salpepi added the type:bug Something isn't working label Jan 4, 2024
@AgustinVallejo
Copy link
Contributor

This has popped up before in #171, going to investigate

@AgustinVallejo
Copy link
Contributor

AgustinVallejo commented Jan 5, 2024

So, as far as I can tell, there are multiple things occurring here:

  1. Might be related to NumberControl behaves badly with arrowButtonOptions.fireOnDown: true scenery-phet#825: Apparently when the button has fireOnDown: false, the endCallback is being called before actually changing the numberProperty. This causes the state to be saved on M-1. This does not happen when fireOnDown: true or just when long-pressing the button.
  2. We cannot bring back fireOnDown: true since it was causing Mass thumb can move on its own #292

Might be a good one to pair as well @pixelzoom

@AgustinVallejo
Copy link
Contributor

After talking with @pixelzoom it seems the potential error of NumberControl is not something we'd want to try to fix. Rather, I'll look into possible workarounds for this issue.

@AgustinVallejo
Copy link
Contributor

Added a fix, please review and mark for cherry picking. Thanks!

@Nancy-Salpepi
Copy link
Author

This looks good on main.

@Nancy-Salpepi
Copy link
Author

This looks good in rc.4
Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants