Closed zepumph closed 2 years ago
Commit comming soon, but I was able to use this patch to test that this is working as expected. When I changed the response levels with preferences checkboxes, the alerts from the Utterance (i.e. ResponesPacket
) were respected.
Index: js/friction/view/describers/BookMovementDescriber.js
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/js/friction/view/describers/BookMovementDescriber.js b/js/friction/view/describers/BookMovementDescriber.js
--- a/js/friction/view/describers/BookMovementDescriber.js (revision eac66e94717f16a7208bc781442da84258f81b21)
+++ b/js/friction/view/describers/BookMovementDescriber.js (date 1629834080588)
@@ -10,6 +10,7 @@
import BorderAlertsDescriber from '../../../../../scenery-phet/js/accessibility/describers/BorderAlertsDescriber.js';
import DirectionEnum from '../../../../../scenery-phet/js/accessibility/describers/DirectionEnum.js';
import MovementDescriber from '../../../../../scenery-phet/js/accessibility/describers/MovementDescriber.js';
+import ResponsePacket from '../../../../../utterance-queue/js/ResponsePacket.js';
import Utterance from '../../../../../utterance-queue/js/Utterance.js';
import friction from '../../../friction.js';
import frictionStrings from '../../../frictionStrings.js';
@@ -64,7 +65,10 @@
// @private - special verbose alert for the first 2 times, then use the default
this.bottomUtterance = new Utterance( {
- alert: [ downRubFastOrSlowString, downRubFastOrSlowString, DEFAULT_MOVEMENT_DESCRIPTIONS.DOWN ],
+ alert: new ResponsePacket( {
+ objectResponse: 'Down',
+ hintResponse: 'Rub fast or slow'
+ } ),
announcerOptions: {
cancelOther: false
}
So the "rub fast or slow" hint is only given when the hint checkbox is provided.
All TODOs have been completed above.
We now have support for ResponesPackets in Utterances, and within the arrays Utterance.alert
takes. I also took on some house keeping in regards to moving responseCollector et al over to utterance-queue.
@jessegreenberg please give this a review. Within the review please comment on if you feel like I missed anything, or if we aren't completely thinking throught part of this refactor.
Otherwise, I'm excited to use this over in https://github.com/phetsims/friction/issues/222!
This is looking really great, nice work. I tested it out with a basic example by modifying the hello-world examples in the utterance-queue README, and it is working great.
I just changed a couple of namespace references from scenery to utteranceQueueNamespace from moving files to this repo.
Hopefully it is proving useful for friction and other instrumentation!
Excellent thanks! I'm going to close for now.
While brainstorming solutions around https://github.com/phetsims/friction/issues/211, @jessegreenberg and I thought it may be helpful to bring the notion of categories of responses into the utterance-queue library. We came up with a "ResponsePacket" which can be added to the definition in AlertableDef, and that Utterance knows how to support. This involves moving a couple of classes from scenery into utterance-queue. Here is our current patch, I'll take it from here.