Skip to content

Commit

Permalink
remove unused ISLCConstants.MASS_RANGE, tweak arrow length function, #76
Browse files Browse the repository at this point in the history
  • Loading branch information
zepumph committed Aug 22, 2019
1 parent 7b2691e commit 2fc1d48
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 25 deletions.
4 changes: 1 addition & 3 deletions js/gravity-force-lab/GravityForceLabConstants.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ define( require => {
const Range = require( 'DOT/Range' );

// constants
const MIN_MASS = 1; // kg
const MIN_MASS = 10; // kg
const MAX_MASS = 1000; // kg
const MAX_DISTANCE_FROM_CENTER = 4.8; // meters, empirically determined boundary for masses
const MASS_BLUE_COLOR = new Color( '#00f' );
Expand All @@ -26,8 +26,6 @@ define( require => {
BACKGROUND_COLOR_PROPERTY: new Property( 'white' ),
MASS_RED_COLOR: MASS_RED_COLOR,
MASS_BLUE_COLOR: MASS_BLUE_COLOR,
MIN_MASS: MIN_MASS,
MAX_MASS: MAX_MASS,
PULL_LOCATION_RANGE: new Range( -MAX_DISTANCE_FROM_CENTER, MAX_DISTANCE_FROM_CENTER ),
LOCATION_SNAP_VALUE: 0.1,
LOCATION_STEP_SIZE: 0.5,
Expand Down
36 changes: 17 additions & 19 deletions js/gravity-force-lab/model/GravityForceLabModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,15 @@ define( function( require ) {
'use strict';

// modules
var BooleanProperty = require( 'AXON/BooleanProperty' );
var gravityForceLab = require( 'GRAVITY_FORCE_LAB/gravityForceLab' );
var GravityForceLabConstants = require( 'GRAVITY_FORCE_LAB/gravity-force-lab/GravityForceLabConstants' );
var inherit = require( 'PHET_CORE/inherit' );
var ISLCModel = require( 'INVERSE_SQUARE_LAW_COMMON/model/ISLCModel' );
var Mass = require( 'GRAVITY_FORCE_LAB/gravity-force-lab/model/Mass' );
var PhysicalConstants = require( 'PHET_CORE/PhysicalConstants' );
var Range = require( 'DOT/Range' );
var Vector2 = require( 'DOT/Vector2' );
var Vector2Property = require( 'DOT/Vector2Property' );
const BooleanProperty = require( 'AXON/BooleanProperty' );
const gravityForceLab = require( 'GRAVITY_FORCE_LAB/gravityForceLab' );
const GravityForceLabConstants = require( 'GRAVITY_FORCE_LAB/gravity-force-lab/GravityForceLabConstants' );
const inherit = require( 'PHET_CORE/inherit' );
const ISLCModel = require( 'INVERSE_SQUARE_LAW_COMMON/model/ISLCModel' );
const Mass = require( 'GRAVITY_FORCE_LAB/gravity-force-lab/model/Mass' );
const PhysicalConstants = require( 'PHET_CORE/PhysicalConstants' );
const Vector2 = require( 'DOT/Vector2' );
const Vector2Property = require( 'DOT/Vector2Property' );

/**
* @param {Tandem} tandem
Expand Down Expand Up @@ -53,22 +52,21 @@ define( function( require ) {
var position1 = -2; // in meters
var position2 = 2; // in meters

var minMassValue = 1; // in kg
var maxMassValue = 1000; // in kg
var valueRange = new Range( minMassValue, maxMassValue );

var baseColor1 = GravityForceLabConstants.MASS_BLUE_COLOR;
var baseColor2 = GravityForceLabConstants.MASS_RED_COLOR;

var density = 150; // in kg/m^3

var mass1 = new Mass( massValue1, position1, valueRange, density, this.constantRadiusProperty, baseColor1, tandem.createTandem( 'mass1' ) );
var mass2 = new Mass( massValue2, position2, valueRange, density, this.constantRadiusProperty, baseColor2, tandem.createTandem( 'mass2' ) );
var mass1 = new Mass( massValue1, position1, GravityForceLabConstants.MASS_RANGE, density,
this.constantRadiusProperty, baseColor1, tandem.createTandem( 'mass1' ) );
var mass2 = new Mass( massValue2, position2, GravityForceLabConstants.MASS_RANGE, density,
this.constantRadiusProperty, baseColor2, tandem.createTandem( 'mass2' ) );

// leverage ISLCModel, in "mass" mode
ISLCModel.call( this, PhysicalConstants.GRAVITATIONAL_CONSTANT, mass1, mass2, GravityForceLabConstants.PULL_LOCATION_RANGE, tandem, {
snapObjectsToNearest: 0.1 // in meters
} );
ISLCModel.call( this, PhysicalConstants.GRAVITATIONAL_CONSTANT, mass1, mass2,
GravityForceLabConstants.PULL_LOCATION_RANGE, tandem, {
snapObjectsToNearest: 0.1 // in meters
} );
}

gravityForceLab.register( 'GravityForceLabModel', GravityForceLabModel );
Expand Down
2 changes: 1 addition & 1 deletion js/gravity-force-lab/view/GravityForceLabScreenView.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ define( function( require ) {

function GravityForceLabScreenView( model, tandem ) {

// force text isn't retrieved direclty in the screenview, we simply initialize and access it in various nodes
// force text isn't retrieved directly in the screenview, we simply initialize and access it in various Nodes
const massDescriber = new MassDescriber( model );
var positionDescriber = new GravityForceLabPositionDescriber( model, mass1AbbreviatedString, mass2AbbreviatedString );
const forceDescriber = new GravityForceLabForceDescriber( model, mass1AbbreviatedString, mass2AbbreviatedString, positionDescriber );
Expand Down
4 changes: 2 additions & 2 deletions js/gravity-force-lab/view/MassNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ define( require => {
// constants
const ARROW_LABEL_COLOR_STRING = '#000';
const MASS_NODE_Y_POSITION = 185;
const MIN_ARROW_WIDTH = .5; // this way the force arrow never disappears when set to the minimum force (which isn't 0)
const MAX_ARROW_WIDTH = 300;
const MIN_ARROW_WIDTH = 1; // this way the force arrow never disappears when set to the minimum force (which isn't 0)
const MAX_ARROW_WIDTH = 700;

class MassNode extends ISLCObjectNode {

Expand Down

0 comments on commit 2fc1d48

Please sign in to comment.