From e9d8ba2c0a5623364f707acb0acbe11599c53ac5 Mon Sep 17 00:00:00 2001 From: chrisklus Date: Mon, 7 Jan 2019 15:03:29 -0700 Subject: [PATCH] Add setMinMax override to RangeWithValue, see https://github.com/phetsims/dot/issues/77 --- js/RangeWithValue.js | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/js/RangeWithValue.js b/js/RangeWithValue.js index f4b86b8..f26b478 100644 --- a/js/RangeWithValue.js +++ b/js/RangeWithValue.js @@ -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) @@ -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