Skip to content

Commit

Permalink
use workaround for Chromebook on first user gesture so that first spe…
Browse files Browse the repository at this point in the history
…ech is still quick, see phetsims/gravity-force-lab-basics#303
  • Loading branch information
jessegreenberg committed Feb 7, 2022
1 parent beb44ad commit b0979bd
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions js/accessibility/voicing/voicingManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,17 @@ class VoicingManager extends Announcer {
// No dispose, as this singleton exists for the lifetime of the runtime.
stepTimer.addListener( this.stepQueue.bind( this ) );

// To get Voicing to happen quickly on Chromebooks we set the counter to a value that will trigger the "engine
// wake" interval on the next animation frame the first time we get a user gesture. See ENGINE_WAKE_INTERVAL
// for more information about this workaround.
const startEngineListener = () => {
this.timeSinceWakingEngine = ENGINE_WAKE_INTERVAL;

// Display is on the namespace but cannot be imported due to circular dependencies
scenery.Display.userGestureEmitter.removeListener( startEngineListener );
};
scenery.Display.userGestureEmitter.addListener( startEngineListener );

this.initialized = true;
}

Expand Down

0 comments on commit b0979bd

Please sign in to comment.