Skip to content

Commit

Permalink
clamp to valid range after constrain/map, phetsims/ratio-and-proporti…
Browse files Browse the repository at this point in the history
  • Loading branch information
zepumph committed Nov 17, 2020
1 parent 16b31b6 commit 278bd57
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions js/accessibility/AccessibleValueHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -557,13 +557,13 @@ const AccessibleValueHandler = {
newValue = roundValue( newValue, this._valueProperty.get(), stepSize );
}
}

// limit the value to the enabled range
newValue = Utils.clamp( newValue, this._rangeProperty.get().min, this._rangeProperty.get().max );
}

// optionally constrain the value further
this._valueProperty.set( this._constrainValue( this._a11yMapValue( newValue, this._valueProperty.get() ) ) );
// optionally constrain and map the value
const constrainedAndMapped = this._constrainValue( this._a11yMapValue( newValue, this._valueProperty.get() ) );

// limit the value to the enabled range
this._valueProperty.set( Utils.clamp( constrainedAndMapped, this._rangeProperty.get().min, this._rangeProperty.get().max ) );

// optional change callback after the valueProperty is set so that the listener can use the new value
this._change( event );
Expand Down

0 comments on commit 278bd57

Please sign in to comment.