From 41c83c2c7777eba4145c65cf7dcee8f9b47fee00 Mon Sep 17 00:00:00 2001 From: AgustinVallejo Date: Fri, 26 Jul 2024 14:12:02 -0500 Subject: [PATCH] Adding range for gravityProperty, see https://github.com/phetsims/density-buoyancy-common/issues/270 --- js/common/model/Gravity.ts | 6 +++--- js/common/view/GravityControlNode.ts | 3 +-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/js/common/model/Gravity.ts b/js/common/model/Gravity.ts index 183527bc..f8135215 100644 --- a/js/common/model/Gravity.ts +++ b/js/common/model/Gravity.ts @@ -17,6 +17,7 @@ import PhetioObject, { PhetioObjectOptions } from '../../../../tandem/js/PhetioO import Tandem from '../../../../tandem/js/Tandem.js'; import PickRequired from '../../../../phet-core/js/types/PickRequired.js'; import Property from '../../../../axon/js/Property.js'; +import Range from '../../../../dot/js/Range.js'; const GRAVITY_TANDEM = Tandem.GLOBAL_MODEL.createTandem( 'gravities' ); @@ -52,9 +53,8 @@ export default class Gravity extends PhetioObject implements HasValueProperty { this.nameProperty = options.nameProperty; this.gravityValueProperty = new NumberProperty( options.value, { - tandem: options.tandem.createTandem( 'gravityValueProperty' ) - - // TODO AV: range for gravity. Consult the slider to check for the range, see https://github.com/phetsims/density-buoyancy-common/issues/270 + tandem: options.tandem.createTandem( 'gravityValueProperty' ), + range: new Range( 0.1, 25 ) } ); this.custom = options.custom; this.hidden = options.hidden; diff --git a/js/common/view/GravityControlNode.ts b/js/common/view/GravityControlNode.ts index c612ac23..4d167a40 100644 --- a/js/common/view/GravityControlNode.ts +++ b/js/common/view/GravityControlNode.ts @@ -6,7 +6,6 @@ * @author Jonathan Olson (PhET Interactive Simulations) */ -import Range from '../../../../dot/js/Range.js'; import PhetFont from '../../../../scenery-phet/js/PhetFont.js'; import { GatedVisibleProperty, Node, Text } from '../../../../scenery/js/imports.js'; import densityBuoyancyCommon from '../../densityBuoyancyCommon.js'; @@ -29,7 +28,7 @@ export default class GravityControlNode extends ComboNumberControl { titleProperty: DensityBuoyancyCommonStrings.gravity.nameStringProperty, valuePatternProperty: DensityBuoyancyCommonStrings.metersPerSecondSquaredPatternStringProperty, property: gravityProperty, - range: new Range( 0.1, 25 ), + range: gravityProperty.customGravity.gravityValueProperty.rangeProperty.value, listParent: listParent, comboItems: gravityProperty.availableValues.map( gravity => { return {