Closed KatieWoe closed 2 years ago
It would be nice to brainstorm some suggestions about how to hand this generally. Perhaps with @jessegreenberg.
I think it is OK that hands continue to control the sim while the dialog is open - sims generally continue to animate while dialogs are open. If we decide to change this I think that will be a larger decision for PhET.
I had voicing for the sim occur as I was trying to change the voice type, since my hands were briefly on screen.
I expected sim voicing to stop while the dialog is opened, maybe there is a loose end in joist about this. If this part is fixed that might be enough for this issue.
I thought that this code would ensure that dialogs silence screen view voicing, but perhaps we need to check on that.
I'll investigate.
This patch works, but I believe we should discuss before I commit. @jessegreenberg, we were using voicingVisible for toggling "sim voicing", but not with dialogs.
Seems potentially like we forgot to get here in https://github.com/phetsims/scenery/issues/1300 even though that was part of that work (not really sure, I can't remember). Anyways! What do you think about this? It should apply to all modal entities, even though we just have dialogs at this point.
Index: js/Sim.ts
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/js/Sim.ts b/js/Sim.ts
--- a/js/Sim.ts (revision 0f2668684a76091bc771b646ff70faf66643f965)
+++ b/js/Sim.ts (date 1664991281019)
@@ -820,6 +820,7 @@
if ( isModal ) {
this.rootNode.interruptSubtreeInput();
this.modalNodeStack.push( popup );
+ this.setNonModelVoicingVisible( false );
}
if ( popup.layout ) {
popup.layout( this.screenBoundsProperty.value! );
@@ -836,6 +837,7 @@
assert && assert( popup && this.modalNodeStack.includes( popup ) );
assert && assert( this.topLayer.hasChild( popup ), 'popup was not shown' );
if ( isModal ) {
+ this.setNonModelVoicingVisible( true );
this.modalNodeStack.remove( popup );
}
this.topLayer.removeChild( popup );
@@ -1041,13 +1043,21 @@
* only Toolbar content is announced.
*/
public setSimVoicingVisible( visible: boolean ): void {
+ this.setNonModelVoicingVisible( visible );
+ this.topLayer && this.topLayer.setVoicingVisible( visible );
+ }
+
+ /**
+ * Sets voicingVisible on all elements "behind" the modal node stack. In this case, voicing should not work for those
+ * components when set to false.
+ * @param visible
+ */
+ public setNonModelVoicingVisible( visible: boolean ): void {
for ( let i = 0; i < this.screens.length; i++ ) {
- this.screens[ i ].view.voicingVisible = visible;
+ this.screens[ i ].view.voicingVisible = visible; // home screen is the first item, if created
}
this.navigationBar.voicingVisible = visible;
- this.topLayer && this.topLayer.setVoicingVisible( visible );
- this.homeScreen && this.homeScreen.view.setVoicingVisible( visible );
}
}
Also, if this works, do we need to do this also for the phet menu or combo box list being open?
@KatieWoe, we have fixed this now. Please confirm on master and let me know how it goes!
Voicing playing when moving hands while the dialog is open no longer occurs on master. Movement itself does still happen. If this is the desired behavior I believe this is fixed.
Test device Dell Operating System Win 11 Browser Chrome Problem description For https://github.com/phetsims/qa/issues/831. When a dialog, such as the preferences menu, is open, typically the controls to the sim behind it pause. With the hand controls, this is not the case. This can lead to some odd seeming behavior. In particular, I had voicing for the sim occur as I was trying to change the voice type, since my hands were briefly on screen. Steps to reproduce
Visuals
Troubleshooting information: