Skip to content

Commit

Permalink
Convert KeyboardDragListener.dragBounds to dragBoundsProperty, phetsi…
Browse files Browse the repository at this point in the history
  • Loading branch information
zepumph committed Dec 16, 2021
1 parent 67b154c commit 0daaefe
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions js/balloons-and-static-electricity/view/BalloonNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,8 @@ class BalloonNode extends Node {
model.isDraggedProperty.link( updateAccessibleDescription );
globalModel.showChargesProperty.link( updateAccessibleDescription );

const dragBoundsProperty = new Property( this.getDragBounds() );

// @private - the drag handler needs to be updated in a step function, see KeyboardDragHandler for more information
let successfulKeyboardDrag = false; // used to hide the "drag" cue once a successful keyboard drag happens
const boundaryUtterance = new Utterance();
Expand All @@ -343,7 +345,7 @@ class BalloonNode extends Node {
shiftDownDelta: 0,
dragVelocity: 300, // in view coordinates per second
shiftDragVelocity: 100, // in view coordinates per second
dragBounds: this.getDragBounds(),
dragBoundsProperty: dragBoundsProperty,
positionProperty: model.positionProperty,
shiftKeyMultiplier: 0.25,
start: event => {
Expand Down Expand Up @@ -434,7 +436,7 @@ class BalloonNode extends Node {

// update the drag bounds when wall visibility changes
globalModel.wall.isVisibleProperty.link( () => {
this.keyboardDragHandler._dragBounds = this.getDragBounds();
dragBoundsProperty.value = this.getDragBounds();
} );

model.resetEmitter.addListener( () => {
Expand Down

0 comments on commit 0daaefe

Please sign in to comment.