Skip to content

Commit

Permalink
workaround for 'Loops' spinner Home/End sounds, #193, phetsims/sun#886
Browse files Browse the repository at this point in the history
  • Loading branch information
pixelzoom committed Jul 16, 2024
1 parent 45031cf commit a72fdd1
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion js/common/view/NumberOfLoopsControl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@

import NumberProperty from '../../../../axon/js/NumberProperty.js';
import faradaysElectromagneticLab from '../../faradaysElectromagneticLab.js';
import { HBox, Text } from '../../../../scenery/js/imports.js';
import { HBox, KeyboardListener, Text } from '../../../../scenery/js/imports.js';
import Tandem from '../../../../tandem/js/Tandem.js';
import NumberSpinner from '../../../../sun/js/NumberSpinner.js';
import FaradaysElectromagneticLabStrings from '../../FaradaysElectromagneticLabStrings.js';
import FELConstants from '../FELConstants.js';
import sharedSoundPlayers from '../../../../tambo/js/sharedSoundPlayers.js';

export default class NumberOfLoopsControl extends HBox {

Expand All @@ -39,6 +40,13 @@ export default class NumberOfLoopsControl extends HBox {
phetioVisiblePropertyInstrumented: false // use numberOfLoopsControl.visibleProperty
} );

//TODO https://github.com/phetsims/sun/issues/886 Delete this workaround when Home/End sound has been added to NumberSpinner.
const pushButtonSoundPlayer = sharedSoundPlayers.get( 'pushButton' );
spinner.addInputListener( new KeyboardListener( {
keys: [ 'home', 'end' ] as const,
fire: () => pushButtonSoundPlayer.play()
} ) );

super( {
isDisposable: false,
children: [ labelText, spinner ],
Expand Down

0 comments on commit a72fdd1

Please sign in to comment.