Skip to content

Commit

Permalink
Adding range for gravityProperty, see #270
Browse files Browse the repository at this point in the history
  • Loading branch information
AgustinVallejo committed Jul 26, 2024
1 parent 7a44737 commit 41c83c2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
6 changes: 3 additions & 3 deletions js/common/model/Gravity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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' );

Expand Down Expand Up @@ -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;
Expand Down
3 changes: 1 addition & 2 deletions js/common/view/GravityControlNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -29,7 +28,7 @@ export default class GravityControlNode extends ComboNumberControl<Gravity> {
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 {
Expand Down

0 comments on commit 41c83c2

Please sign in to comment.