Skip to content

Commit

Permalink
pull strings should be based on the range ranges as force arrow strin…
Browse files Browse the repository at this point in the history
  • Loading branch information
zepumph committed Oct 7, 2019
1 parent b2132e7 commit 4999161
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions js/view/describers/ForceDescriber.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,8 @@ define( require => {
const inverseSquareLawCommon = require( 'INVERSE_SQUARE_LAW_COMMON/inverseSquareLawCommon' );
const ISLCA11yStrings = require( 'INVERSE_SQUARE_LAW_COMMON/ISLCA11yStrings' );
const ISLCDescriber = require( 'INVERSE_SQUARE_LAW_COMMON/view/describers/ISLCDescriber' );
const LinearFunction = require( 'DOT/LinearFunction' );
const ScientificNotationNode = require( 'SCENERY_PHET/ScientificNotationNode' );
const StringUtils = require( 'PHETCOMMON/util/StringUtils' );
const Util = require( 'DOT/Util' );

// strings
const unitsNewtonsString = require( 'string!INVERSE_SQUARE_LAW_COMMON/units.newtons' );
Expand Down Expand Up @@ -134,10 +132,6 @@ define( require => {
this.forceValueToString = options.forceValueToString;
this.convertForce = options.convertForce;

// @private - empirically divide by 2 to give a good range to the pull force regions
this.forceToPullIndex = new LinearFunction( model.getMinForce(), model.getMaxForce() / 2,
0, PULL_EFFORT_STINGS.length - 1, true );

// @private {number} - // 1 -> growing, 0 -> no change, -1 -> shrinking
this.vectorChangeDirection = 0;
this.forceVectorsString = options.forceVectorsString;
Expand Down Expand Up @@ -356,14 +350,14 @@ define( require => {
}

/**
* Returns the qualitiative amount of pull/push the robots are currently exerting.
* Returns the qualitiative amount of pull/push the robots are currently exerting. This uses the same range as
* the force vector (or "arrow" in GFLB) size regions.
*
* @returns {string}
* @private
*/
getRobotEffort() {
const effortIndex = Util.roundSymmetric( this.forceToPullIndex( this.forceProperty.get() ) );
return PULL_EFFORT_STINGS[ effortIndex ];
return PULL_EFFORT_STINGS[ this.getForceVectorIndex( this.forceProperty.get(), PULL_EFFORT_STINGS.length ) ];
}

/**
Expand Down

0 comments on commit 4999161

Please sign in to comment.