Skip to content

Commit

Permalink
Update usages of KeyboardListener and KeyboardDragListener after chan…
Browse files Browse the repository at this point in the history
  • Loading branch information
jessegreenberg committed Apr 25, 2024
1 parent ebbb453 commit 3b8218e
Showing 1 changed file with 11 additions and 15 deletions.
26 changes: 11 additions & 15 deletions js/intro/view/EFACIntroScreenView.js
Original file line number Diff line number Diff line change
Expand Up @@ -290,13 +290,12 @@ class EFACIntroScreenView extends ScreenView {
up: leftHeaterCoolerUpInputAction
} ) );

leftHeaterCoolerNode.addInputListener( new KeyboardListener( {
keys: EnglishStringKeyUtils.RANGE_KEYS,
listenerFireTrigger: 'both',
callback: event => event.type === 'keydown' ?
leftHeaterCoolerDownInputAction() :
leftHeaterCoolerUpInputAction()
} ) );

const leftKeyboardListener = new KeyboardListener( { keys: EnglishStringKeyUtils.RANGE_KEYS } );
leftHeaterCoolerNode.addInputListener( leftKeyboardListener );
leftKeyboardListener.isPressedProperty.link( pressed => {
pressed ? leftHeaterCoolerDownInputAction() : leftHeaterCoolerUpInputAction();
} );

const rightHeaterCoolerDownInputAction = () => {

Expand All @@ -316,14 +315,11 @@ class EFACIntroScreenView extends ScreenView {
up: rightHeaterCoolerUpInputAction
} ) );

// listen to keyboard events on the right heater-cooler
rightHeaterCoolerNode.addInputListener( new KeyboardListener( {
keys: EnglishStringKeyUtils.RANGE_KEYS,
listenerFireTrigger: 'both',
callback: event => event.type === 'keydown' ?
rightHeaterCoolerDownInputAction() :
rightHeaterCoolerUpInputAction()
} ) );
const rightKeyboardListener = new KeyboardListener( { keys: EnglishStringKeyUtils.RANGE_KEYS } );
rightHeaterCoolerNode.addInputListener( rightKeyboardListener );
rightKeyboardListener.isPressedProperty.link( pressed => {
pressed ? rightHeaterCoolerDownInputAction() : rightHeaterCoolerUpInputAction();
} );

rightBurnerBounds = model.rightBurner.getBounds();
}
Expand Down

0 comments on commit 3b8218e

Please sign in to comment.