Skip to content

Commit

Permalink
Add setMinMax override to RangeWithValue, see #77
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisklus committed Jan 7, 2019
1 parent 4aa7d0a commit e9d8ba2
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions js/RangeWithValue.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2013-2018, University of Colorado Boulder
// Copyright 2013-2019, University of Colorado Boulder

/**
* A numeric range with an optional default value.
* A numeric range with a required default value.
*
* @author Chris Malley (PixelZoom, Inc.)
* @author Chris Klusendorf (PhET Interactive Simulations)
Expand Down Expand Up @@ -68,6 +68,19 @@ define( function( require ) {
Range.prototype.setMax.call( this, max );
},

/**
* Setter for min and max
* @param {number} min
* @param {number} max
* @public
* @override
*/
setMinMax: function( min, max ) {
assert && assert( this._defaultValue >= min, 'min must be <= defaultValue: ' + min );
assert && assert( this._defaultValue <= max, 'max must be >= defaultValue: ' + max );
Range.prototype.setMinMax.call( this, min, max );
},

/**
* Converts the attributes of this range to a string
* @public
Expand Down

0 comments on commit e9d8ba2

Please sign in to comment.