Skip to content

Commit

Permalink
SelfVoicingInputListener -> VoicingInputListener, see phetsims/tasks#…
Browse files Browse the repository at this point in the history
  • Loading branch information
jessegreenberg committed Mar 24, 2021
1 parent e09e3a0 commit 43a6053
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 18 deletions.
8 changes: 4 additions & 4 deletions js/accessibility/speaker/SelfVoicingQuickControl.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import Panel from '../../../../sun/js/Panel.js';
import selfVoicingIconImage from '../../../images/self-voicing-icon_png.js';
import sceneryPhet from '../../sceneryPhet.js';
import levelSpeakerModel from './levelSpeakerModel.js';
import SelfVoicingInputListener from './SelfVoicingInputListener.js';
import VoicingInputListener from './VoicingInputListener.js';

// strings for self-voicing content - these should not be translatable and are therefore not
// added to the strings file - I also don't know if "prototype" strings can go into translatable files
Expand Down Expand Up @@ -110,7 +110,7 @@ class SelfVoicingQuickControl extends Node {
sideLength: 20
} );

this.expandCollapseButton.addInputListener( new SelfVoicingInputListener( {
this.expandCollapseButton.addInputListener( new VoicingInputListener( {
onFocusIn: () => {
const string = StringUtils.fillIn( expandCollapseButtonPatternString, {
action: openProperty.get() ? hideString : showString
Expand Down Expand Up @@ -146,7 +146,7 @@ class SelfVoicingQuickControl extends Node {
listener: listener
} );

button.addInputListener( new SelfVoicingInputListener( {
button.addInputListener( new VoicingInputListener( {
onFocusIn: () => {
phet.joist.sim.voicingUtteranceQueue.addToBack( levelSpeakerModel.collectResponses( contentString ) );
},
Expand Down Expand Up @@ -193,7 +193,7 @@ class SelfVoicingQuickControl extends Node {
} );

// other listeners are added in createSpeechButton
muteSpeechButton.addInputListener( new SelfVoicingInputListener( {
muteSpeechButton.addInputListener( new VoicingInputListener( {
onFocusIn: () => {
phet.joist.sim.voicingUtteranceQueue.addToBack( levelSpeakerModel.collectResponses( muteSpeechString ) );
},
Expand Down
8 changes: 4 additions & 4 deletions js/accessibility/speaker/SelfVoicingWrapperNode.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2020, University of Colorado Boulder
/**
* Wraps a Node with another that is better for hit testing for the purpses
* of the self-voicing prototype. Also adds a SelfVoicingInputListener to the
* of the self-voicing prototype. Also adds a VoicingInputListener to the
* Node so that it creates speech and highlighting
*
* @author Jesse Greenberg
Expand All @@ -11,7 +11,7 @@ import merge from '../../../../phet-core/js/merge.js';
import sceneryPhet from '../../sceneryPhet.js';
import Rectangle from '../../../../scenery/js/nodes/Rectangle.js';
import VoicingHighlight from './VoicingHighlight.js';
import SelfVoicingInputListener from './SelfVoicingInputListener.js';
import VoicingInputListener from './VoicingInputListener.js';
import Node from '../../../../scenery/js/nodes/Node.js';

class SelfVoicingWrapperNode extends Node {
Expand All @@ -24,7 +24,7 @@ class SelfVoicingWrapperNode extends Node {

options = merge( {

// {Object} - options passed along to the SelfVoicingInputListener
// {Object} - options passed along to the VoicingInputListener
listenerOptions: {},

// a custom hit target to be used instead of the default one, if a unique
Expand All @@ -48,7 +48,7 @@ class SelfVoicingWrapperNode extends Node {
// by default, visibility of this Node will control speech output
representedNode: this
}, options.listenerOptions );
const listener = new SelfVoicingInputListener( options.listenerOptions );
const listener = new VoicingInputListener( options.listenerOptions );

if ( options.customNode === null ) {
const wrapperRectangle = new Rectangle( {} );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import speakerHighlighter from './speakerHighlighter.js';
import merge from '../../../../phet-core/js/merge.js';
import sceneryPhet from '../../sceneryPhet.js';

class SelfVoicingInputListener {
class VoicingInputListener {
constructor( options ) {
options = merge( {

Expand Down Expand Up @@ -208,5 +208,5 @@ class SelfVoicingInputListener {
}
}

sceneryPhet.register( 'SelfVoicingInputListener', SelfVoicingInputListener );
export default SelfVoicingInputListener;
sceneryPhet.register( 'VoicingInputListener', VoicingInputListener );
export default VoicingInputListener;
10 changes: 5 additions & 5 deletions js/accessibility/speaker/VoicingPreferencesDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import VoicingUtterance from '../../../../utterance-queue/js/VoicingUtterance.js
import PhetFont from '../../PhetFont.js';
import sceneryPhet from '../../sceneryPhet.js';
import levelSpeakerModel from './levelSpeakerModel.js';
import SelfVoicingInputListener from './SelfVoicingInputListener.js';
import VoicingInputListener from './VoicingInputListener.js';

// constants
const TITLE_FONT = new PhetFont( { size: 16, weight: 'bold' } );
Expand Down Expand Up @@ -92,7 +92,7 @@ class VoicingPreferencesDialog extends Dialog {
// This is just a proof of concept so I would rather hack this here than put in ComboBox/
// ComboBoxListItemNode. self-voicing ends up being a long term feature we will move this
// kind of thing to those types with more consideration.
voiceComboBox.listBox.addInputListener( new SelfVoicingInputListener( {
voiceComboBox.listBox.addInputListener( new VoicingInputListener( {
onFocusIn: event => {
const response = levelSpeakerModel.collectResponses( Display.focusedNode.innerContent );
phet.joist.sim.voicingUtteranceQueue.addToBack( response );
Expand Down Expand Up @@ -124,7 +124,7 @@ class VoicingPreferencesDialog extends Dialog {
phet.joist.sim.voicingUtteranceQueue.addToBack( content );
} );

voiceComboBox.addInputListener( new SelfVoicingInputListener( {
voiceComboBox.addInputListener( new VoicingInputListener( {
onFocusIn: () => {
const response = levelSpeakerModel.collectResponses( changeVoiceString );

Expand Down Expand Up @@ -249,7 +249,7 @@ class LevelModeControls extends VBox {

// self-voicing behavior for the checkboxes themselves
levelsCheckboxGroup.children.forEach( child => {
child.addInputListener( new SelfVoicingInputListener( {
child.addInputListener( new VoicingInputListener( {
onFocusIn: () => {
const response = levelSpeakerModel.collectResponses( child.labelContent );
phet.joist.sim.voicingUtteranceQueue.addToBack( response );
Expand All @@ -258,7 +258,7 @@ class LevelModeControls extends VBox {
} );

generalCheckboxGroup.children.forEach( child => {
child.addInputListener( new SelfVoicingInputListener( {
child.addInputListener( new VoicingInputListener( {
onFocusIn: () => {
const response = levelSpeakerModel.collectResponses( child.labelContent );
phet.joist.sim.voicingUtteranceQueue.addToBack( response );
Expand Down
4 changes: 2 additions & 2 deletions js/accessibility/speaker/speakerHighlighter.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

/**
* Manages highlights to indicate the state of self-voicing speech, as well as what objects have self-voicing content.
* This is coupled with SelfVoicingInputListener, which updates the Properties tracking the pointer's over Trail.
* This is coupled with VoicingInputListener, which updates the Properties tracking the pointer's over Trail.
*
* Very rough, prototype code. Uncertain whether this design will be around long-term.
* For now, goes through FocusOverlay to display the highlight for a Node, but does so by accessing private things.
Expand All @@ -24,7 +24,7 @@ class SpeakerHighlighter {
constructor() {

// @private {Property.<boolean|null>} - the current trail which has a Pointer over it - updated in
// SelfVoicingInputListener
// VoicingInputListener
this.overTrailProperty = new Property( null );

// @private {Property.<boolean|null>} - the current trail to wich the webSpeaker is curently speaking about
Expand Down

0 comments on commit 43a6053

Please sign in to comment.