Skip to content

Commit

Permalink
prevented overlap in account values when set via buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
jbphet committed Apr 1, 2020
1 parent 392f5d6 commit f09ed79
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions js/common/model/NumberLine.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ define( require => {
this.residentPoints.addItemAddedListener( addedPoint => {

// listener to make sure point lands in a good point when released
const pointDragListener = dragging => {
const pointIsDraggingListener = dragging => {

// do nothing if dragging or we are the only point here/there are no points here
if ( dragging || this.getPointsAt( addedPoint.valueProperty.value ).length <= 1 ) {
Expand All @@ -114,12 +114,12 @@ define( require => {
}
addedPoint.valueProperty.value = this.getNearestUnoccupiedValue( beginningValue );
};
addedPoint.isDraggingProperty.link( pointDragListener );
addedPoint.isDraggingProperty.link( pointIsDraggingListener );

// remove the listener when the point is removed from the number line
this.residentPoints.addItemRemovedListener( removedPoint => {
if ( removedPoint === addedPoint ) {
removedPoint.isDraggingProperty.unlink( pointDragListener );
removedPoint.isDraggingProperty.unlink( pointIsDraggingListener );
}
} );
} );
Expand Down

0 comments on commit f09ed79

Please sign in to comment.