diff --git a/js/GravityForceLabA11yStrings.js b/js/GravityForceLabA11yStrings.js index 34cf6384..1d3da645 100644 --- a/js/GravityForceLabA11yStrings.js +++ b/js/GravityForceLabA11yStrings.js @@ -322,9 +322,12 @@ define( require => { hintPattern: { value: '{{playHint}} {{releaseHint}}' }, - jumpKeyboardHint: { + grabbedJumpKeyboardHint: { value: 'Hold J plus C keys to jump ruler to center of m1.' }, + jumpCenterKeyboardHint: { + value: 'Hold J plus H keys to release ruler in home position.' + }, moveKeyboardHint: { value: 'Move ruler left and right with letter keys A and D.' }, @@ -338,7 +341,7 @@ define( require => { value: 'Centers {{distanceAndUnits}} apart.' }, jumpCenterMassAlert: { - value: 'Ruler zero mark at center of {{object1}}. {{centersApart}}' + value: 'Ruler zero mark at center of {{object1}}. {{centersApart}} {{supplementalHint}}' }, // vertical ruler positions diff --git a/js/view/describers/GravityForceLabRulerDescriber.js b/js/view/describers/GravityForceLabRulerDescriber.js index 42a56007..e45a4fe4 100644 --- a/js/view/describers/GravityForceLabRulerDescriber.js +++ b/js/view/describers/GravityForceLabRulerDescriber.js @@ -26,7 +26,8 @@ define( require => { const releaseAndExploreHintString = GravityForceLabA11yStrings.releaseAndExploreHint.value; const hintPatternString = GravityForceLabA11yStrings.hintPattern.value; const centersApartPatternString = GravityForceLabA11yStrings.centersApartPattern.value; - const jumpKeyboardHintString = GravityForceLabA11yStrings.jumpKeyboardHint.value; + const grabbedJumpKeyboardHintString = GravityForceLabA11yStrings.grabbedJumpKeyboardHint.value; + const jumpCenterKeyboardHintString = GravityForceLabA11yStrings.jumpCenterKeyboardHint.value; const moveKeyboardHintString = GravityForceLabA11yStrings.moveKeyboardHint.value; const gestureHintString = GravityForceLabA11yStrings.gestureHint.value; const keyboardReleaseHintString = GravityForceLabA11yStrings.keyboardReleaseHint.value; @@ -80,8 +81,12 @@ define( require => { this.horizontalDistanceThisGrab = 0; // for horizontal movement alerts this.previousVerticalRegionIndex = this.getVerticalRegionIndex(); // for vertical movement alerts this.previousRulerPosition = this.rulerPositionProperty.value; - this.movementUtterance = new Utterance(); // utterance to alert vertical and horizontal movement alerts this.justMovementAlerted = false; + + // @private - alerts for different ruler specific alerts + this.jumpCenterUtterance = new Utterance(); + this.jumpHomeUtterance = new Utterance(); + this.movementUtterance = new Utterance(); // utterance to alert vertical and horizontal movement alerts this.releaseAndExploreUtterance = new Utterance( { alert: releaseAndExploreHintString, predicate: () => this.releaseAndExploreUtterance.numberOfTimesAlerted < 2 // only alert for the first two time. @@ -152,7 +157,7 @@ define( require => { if ( phet.joist.sim.supportsGestureA11y ) { return gestureHintString; } - let playHint = jumpKeyboardHintString; + let playHint = grabbedJumpKeyboardHintString; const regionIndex = this.getVerticalRegionIndex(); // if on the second grab, the user still isn't in a measurable location, then repeat the first hint to jump to the @@ -233,6 +238,15 @@ define( require => { return currentRegion; } + /** + * @public + * Alert that the ruler has jumped to the home position + */ + alertJumpHome() { + this.jumpHomeUtterance.alert = this.getHomePositionString(); + phet.joist.sim.utteranceQueue.addToBack( this.jumpHomeUtterance ); + } + /** * @public * @returns {string} @@ -240,16 +254,28 @@ define( require => { getJumpCenterMassAlert() { return StringUtils.fillIn( jumpCenterMassAlertString, { centersApart: this.getCentersApartDistance(), - object1: this.getObjectLabelFromEnum( ISLCObjectEnum.OBJECT_ONE ) + object1: this.getObjectLabelFromEnum( ISLCObjectEnum.OBJECT_ONE ), + supplementalHint: this.jumpCenterUtterance.numberOfTimesAlerted < 2 ? jumpCenterKeyboardHintString : '' } ); } + /** + * @public + * Alert that the ruler has jumped to the center of a mass + */ + alertJumpCenterMass() { + this.jumpCenterUtterance.alert = this.getJumpCenterMassAlert(); + phet.joist.sim.utteranceQueue.addToBack( this.jumpCenterUtterance ); + } + /** * @public */ reset() { this.grabbedCount = 0; this.releaseAndExploreUtterance.reset(); + this.jumpCenterUtterance.reset(); + this.jumpHomeUtterance.reset(); this.movementUtterance.reset(); } }