Skip to content

Commit

Permalink
Use number suite common speech synthesis button, see: #22
Browse files Browse the repository at this point in the history
  • Loading branch information
marlitas committed Dec 11, 2024
1 parent 7d80919 commit 2ed963c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 46 deletions.
7 changes: 4 additions & 3 deletions js/common/view/NumberPairsScreenView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,10 @@ import NumberLineNode from './NumberLineNode.js';
import NumberLineOptionsCheckboxGroup from './NumberLineOptionsCheckboxGroup.js';
import OrganizeBeadsButton from './OrganizeBeadsButton.js';
import RepresentationRadioButtonGroup from './RepresentationRadioButtonGroup.js';
import SpeechSynthesisButton from './SpeechSynthesisButton.js';
import TenFrameButton from './TenFrameButton.js';
import SpeechSynthesisButton from '../../../../number-suite-common/js/common/view/SpeechSynthesisButton.js';
import numberPairsSpeechSynthesisAnnouncer from './numberPairsSpeechSynthesisAnnouncer.js';
import numberPairsUtteranceQueue from './numberPairsUtteranceQueue.js';


type SelfOptions = {
Expand Down Expand Up @@ -114,8 +116,7 @@ export default class NumberPairsScreenView extends ScreenView {
/**
* Create the buttons along the left edge of each screen
*/
const speechSynthesisButton = new SpeechSynthesisButton( {
tandem: options.tandem.createTandem( 'speechSynthesisButton' ),
const speechSynthesisButton = new SpeechSynthesisButton( numberPairsSpeechSynthesisAnnouncer, numberPairsUtteranceQueue, {
x: this.layoutBounds.minX + NumberPairsConstants.SCREEN_VIEW_X_MARGIN,
y: this.layoutBounds.minY + NumberPairsConstants.SCREEN_VIEW_Y_MARGIN
} );
Expand Down
35 changes: 0 additions & 35 deletions js/common/view/SpeechSynthesisButton.ts

This file was deleted.

12 changes: 4 additions & 8 deletions js/common/view/numberPairsUtteranceQueue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,9 @@ import StringProperty from '../../../../axon/js/StringProperty.js';
import TProperty from '../../../../axon/js/TProperty.js';
import TReadOnlyProperty from '../../../../axon/js/TReadOnlyProperty.js';
import NumberSuiteCommonUtteranceQueue from '../../../../number-suite-common/js/common/view/NumberSuiteCommonUtteranceQueue.js';
import TenScreen from '../../ten/TenScreen.js';
import TwentyScreen from '../../twenty/TwentyScreen.js';
import numberPairs from '../../numberPairs.js';
import NumberPairsPreferences from '../model/NumberPairsPreferences.js';
import numberPairsSpeechSynthesisAnnouncer from './numberPairsSpeechSynthesisAnnouncer.js';
import IntroScreen from '../../intro/IntroScreen.js';
import SumScreen from '../../sum/SumScreen.js';

class NumberPairsUtteranceQueue extends NumberSuiteCommonUtteranceQueue {

Expand Down Expand Up @@ -56,10 +52,10 @@ class NumberPairsUtteranceQueue extends NumberSuiteCommonUtteranceQueue {

// We want the speech data to reflect the selected screen. Returns null for screens that do not support speech
// synthesis.
return selectedScreen instanceof IntroScreen ? introScreenSpeechData :
selectedScreen instanceof TenScreen ? tenScreenSpeechData :
selectedScreen instanceof TwentyScreen ? twentyScreenSpeechData :
selectedScreen instanceof SumScreen ? sumScreenSpeechData :
return selectedScreen instanceof phet.numberPairs.IntroScreen ? introScreenSpeechData :
selectedScreen instanceof phet.numberPairs.TenScreen ? tenScreenSpeechData :
selectedScreen instanceof phet.numberPairs.TwentyScreen ? twentyScreenSpeechData :
selectedScreen instanceof phet.numberPairs.SumScreen ? sumScreenSpeechData :
null;
} );

Expand Down

0 comments on commit 2ed963c

Please sign in to comment.