From c0ed775e83a054f9237a580b39d78c6c49b2053f Mon Sep 17 00:00:00 2001 From: zepumph Date: Tue, 5 Nov 2019 16:40:12 -0900 Subject: [PATCH] utteranceQueue usages from singleton to sim.display, https://github.com/phetsims/utterance-queue/issues/1 --- js/friction/view/FrictionAlertManager.js | 8 +++----- js/friction/view/FrictionGrabDragInteraction.js | 6 ++---- js/friction/view/describers/BreakAwayDescriber.js | 8 +++----- .../view/describers/TemperatureIncreasingDescriber.js | 6 ++---- 4 files changed, 10 insertions(+), 18 deletions(-) diff --git a/js/friction/view/FrictionAlertManager.js b/js/friction/view/FrictionAlertManager.js index 77b7a599..6bbb697b 100644 --- a/js/friction/view/FrictionAlertManager.js +++ b/js/friction/view/FrictionAlertManager.js @@ -12,9 +12,7 @@ define( require => { const FrictionA11yStrings = require( 'FRICTION/friction/FrictionA11yStrings' ); const StringUtils = require( 'PHETCOMMON/util/StringUtils' ); const Utterance = require( 'UTTERANCE_QUEUE/Utterance' ); - const utteranceQueue = require( 'UTTERANCE_QUEUE/utteranceQueue' ); - - // a11y strings +// a11y strings const frictionIncreasingAtomsJigglingTemperatureFirstPatternString = FrictionA11yStrings.frictionIncreasingAtomsJigglingTemperatureFirstPattern.value; const frictionIncreasingAtomsJigglingTemperaturePatternString = FrictionA11yStrings.frictionIncreasingAtomsJigglingTemperaturePattern.value; const atomsJiggleTinyBitTempCoolString = FrictionA11yStrings.atomsJiggleTinyBitTempCool.value; @@ -49,7 +47,7 @@ define( require => { } ); temperatureJiggleUtterance.alert = string; - utteranceQueue.addToBack( temperatureJiggleUtterance ); + phet.joist.sim.display.utteranceQueue.addToBack( temperatureJiggleUtterance ); }, /** @@ -57,7 +55,7 @@ define( require => { * @public */ alertSettledAndCool: function() { - utteranceQueue.addToBack( atomsJiggleTinyBitTempCoolString ); + phet.joist.sim.display.utteranceQueue.addToBack( atomsJiggleTinyBitTempCoolString ); }, // Threshold that must be reached from initial temp to new temp to alert that the temperature changed, in amplitude (see model for more info) diff --git a/js/friction/view/FrictionGrabDragInteraction.js b/js/friction/view/FrictionGrabDragInteraction.js index b31590d5..c45042f4 100644 --- a/js/friction/view/FrictionGrabDragInteraction.js +++ b/js/friction/view/FrictionGrabDragInteraction.js @@ -13,9 +13,7 @@ define( require => { const FrictionModel = require( 'FRICTION/friction/model/FrictionModel' ); const GrabDragInteraction = require( 'SCENERY_PHET/accessibility/GrabDragInteraction' ); const merge = require( 'PHET_CORE/merge' ); - const utteranceQueue = require( 'UTTERANCE_QUEUE/utteranceQueue' ); - - // a11y strings +// a11y strings const initialGrabbedNotTouchingString = FrictionA11yStrings.initialGrabbedNotTouching.value; const grabbedNotTouchingString = FrictionA11yStrings.grabbedNotTouching.value; const initialGrabbedTouchingString = FrictionA11yStrings.initialGrabbedTouching.value; @@ -55,7 +53,7 @@ define( require => { if ( this.successfullyInteracted ) { alert = alerts.subsequent; } - utteranceQueue.addToBack( alert ); + phet.joist.sim.display.utteranceQueue.addToBack( alert ); }; super( wrappedNode, options ); diff --git a/js/friction/view/describers/BreakAwayDescriber.js b/js/friction/view/describers/BreakAwayDescriber.js index 44293382..17885c91 100644 --- a/js/friction/view/describers/BreakAwayDescriber.js +++ b/js/friction/view/describers/BreakAwayDescriber.js @@ -14,9 +14,7 @@ define( require => { const FrictionModel = require( 'FRICTION/friction/model/FrictionModel' ); const StringUtils = require( 'PHETCOMMON/util/StringUtils' ); const timer = require( 'AXON/timer' ); - const utteranceQueue = require( 'UTTERANCE_QUEUE/utteranceQueue' ); - - // a11y strings +// a11y strings const capitalizedVeryHotString = FrictionA11yStrings.capitalizedVeryHot.value; const breakAwaySentenceFirstString = FrictionA11yStrings.breakAwaySentenceFirst.value; const breakAwaySentenceAgainString = FrictionA11yStrings.breakAwaySentenceAgain.value; @@ -76,10 +74,10 @@ define( require => { // If there aren't any more atoms to break away if ( this.model.numberOfAtomsEvaporated >= FrictionModel.NUMBER_OF_EVAPORABLE_ATOMS ) { assert && assert( this.alertedBreakAwayProperty.value, 'If this is the first alert, then we have problems' ); - utteranceQueue.addToFront( BREAK_AWAY_NONE_LEFT ); + phet.joist.sim.display.utteranceQueue.addToFront( BREAK_AWAY_NONE_LEFT ); } else { - utteranceQueue.addToFront( this.alertedBreakAwayProperty.value ? BREAK_AWAY_THRESHOLD_AGAIN : BREAK_AWAY_THRESHOLD_FIRST ); + phet.joist.sim.display.utteranceQueue.addToFront( this.alertedBreakAwayProperty.value ? BREAK_AWAY_THRESHOLD_AGAIN : BREAK_AWAY_THRESHOLD_FIRST ); } this.alertedBreakAwayProperty.value = true; diff --git a/js/friction/view/describers/TemperatureIncreasingDescriber.js b/js/friction/view/describers/TemperatureIncreasingDescriber.js index d3e3a667..e2eff838 100644 --- a/js/friction/view/describers/TemperatureIncreasingDescriber.js +++ b/js/friction/view/describers/TemperatureIncreasingDescriber.js @@ -23,9 +23,7 @@ define( require => { const StringUtils = require( 'PHETCOMMON/util/StringUtils' ); const timer = require( 'AXON/timer' ); const Utterance = require( 'UTTERANCE_QUEUE/Utterance' ); - const utteranceQueue = require( 'UTTERANCE_QUEUE/utteranceQueue' ); - - // a11y strings +// a11y strings const moreString = FrictionA11yStrings.more.value; const fasterString = FrictionA11yStrings.faster.value; const nowHotterString = FrictionA11yStrings.nowHotter.value; @@ -159,7 +157,7 @@ define( require => { * @private */ alertMaxTemp() { - this.alert( () => { utteranceQueue.addToBack( this.maxTempUtterance ); } ); + this.alert( () => { phet.joist.sim.display.utteranceQueue.addToBack( this.maxTempUtterance ); } ); } /**