phetsims / balloons-and-static-electricity

"Balloons and Static Electricity" is an educational simulation in HTML5, by PhET Interactive Simulations.
http://phet.colorado.edu/en/simulation/balloons-and-static-electricity
GNU General Public License v3.0
6 stars 10 forks source link

Getting some alerts about balloon movement after balloon is released with no charge #506

Closed jessegreenberg closed 3 years ago

jessegreenberg commented 3 years ago

While working on #491 @terracoda and I noticed this bug.

terracoda commented 3 years ago

Yes, I can sometimes hear a one or left, right, up, down alerts after a release. And I am not hearing "Released." Released seems to get overridden by the balloon position response that is said right after the release.

I am not sure there if there is a simple solution to make sure the release response is heard.

terracoda commented 3 years ago

@jessegreenberg, after re-listening on MacOS and iOS, I am wondering how much it would cost us to not have these simple directional responses when a balloon is in the grabbed state. I think we need them for independent balloon movement, "Green Balloon, moves slowly left."..."Green Balloon, now up." etc. But I have a feeling we do not need them when the balloon is grabbed.

If this is not straight-forward and you see potential for unintended side-effects, lets leave them in. Otherwise, I'd love a dev version that has them removed.

jessegreenberg commented 3 years ago

This was also caused by https://github.com/phetsims/balloons-and-static-electricity/issues/455

jessegreenberg commented 3 years ago

The problem is the order we are sending alerts to the queue.

image

The direction utterance needs to happen before the released alert, but because of polling it is happening last.

jessegreenberg commented 3 years ago

The ordering problem is also because we are using GrabDragInteraction. The GrabDragInteraction sends the 'released' alert as soon as it happens but the BalloonDescriber sends the "No change..." and "Right." alerts as they should be ordered.

We probably need to remove the alert in GrabDragInteraction by making it optional so we can alert it exactly when we want in BASE.

jessegreenberg commented 3 years ago

This was fixed in the above commit. The directionUtterance had an alertStableDelay such that it made the alert come after the "released" utterance of the GrabDragInteraction. The alerts are added to the back of the queue in the right order so removing the alertStableDelay for the directionUtterance fixed the problem.

I feel confident that this is a safe change because the alert of direction change during drag only happens if the change in position of the balloon is large enough, so the direction change information will not repeat itself unecessarily.

Closing.