Skip to content

Commit

Permalink
remove comments, implement proper string usage
Browse files Browse the repository at this point in the history
  • Loading branch information
mbarlow12 committed Dec 11, 2018
1 parent 97e6319 commit 0138c64
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
6 changes: 6 additions & 0 deletions js/gravity-force-lab/GravityForceLabA11yStrings.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ define( require => {
mass2RedSphere: {
value: 'm2, Red Sphere'
},
valueUnitstPattern: {
value: '{{value}} {{units}}'
},
positionMeterPattern: {
value: '{{position}} meter'
},


////////////////////////
Expand Down
17 changes: 7 additions & 10 deletions js/gravity-force-lab/view/GravityForceLabStringManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ define( require => {

// strings
const micronewtonsString = GravityForceLabA11yStrings.micronewtons.value;
// const mass1AbbreviatedString = require( 'string!GRAVITY_FORCE_LAB/mass1Abbreviated' );
// const mass2AbbreviatedString = require( 'string!GRAVITY_FORCE_LAB/mass2Abbreviated' );
const unitsNewtonsString = require( 'string!INVERSE_SQUARE_LAW_COMMON/units.newtons' );

const massValuesAndComparisonSummaryPatternString = GravityForceLabA11yStrings.massValuesAndComparisonSummaryPattern.value;
// TODO: proper string usage
const sizeAndPositionPatternString = GravityForceLabA11yStrings.sizeAndPositionPattern.value;
const valueUnitsPatternString = GravityForceLabA11yStrings.valueUnitstPattern.value;
const positionMeterPatternString = GravityForceLabA11yStrings.positionMeterPattern.value;

const muchMuchSmallerThanString = GravityForceLabA11yStrings.muchMuchSmallerThan.value;
const muchSmallerThanString = GravityForceLabA11yStrings.muchSmallerThan.value;
Expand All @@ -54,20 +54,19 @@ define( require => {
class GravityForceLabStringManager extends ISLCStringManager {
constructor( model, object1Label, object2Label, options ) {

// TODO: proper string handling
const convertForceValue = forceValue => {
let units;
let value;
if ( model.scientificNotationProperty.get() ) {
units = 'newtons';
units = unitsNewtonsString;
value = ISLCStringManager.getForceInScientificNotation( forceValue, 2 );
}
else {
units = 'micronewtons';
units = micronewtonsString;
value = Util.toFixedNumber( forceValue * MICRO_CONVERSION_FACTOR, 6 );
}

return `${value} ${units}`;
return StringUtils.fillIn( valueUnitsPatternString, { value, units } );
};

options = _.extend( {
Expand All @@ -77,7 +76,7 @@ define( require => {
convertDistanceMetric: distance => Util.toFixedNumber( distance, 1 ),
formatPositionUnitMark: position => {
position = Util.toFixedNumber( position, 1 );
return StringUtils.fillIn( '{{position}} meter', { position } );
return StringUtils.fillIn( positionMeterPatternString, { position } );
},
formatMassValue: mass => mass
}, options );
Expand All @@ -97,8 +96,6 @@ define( require => {
[ model.object1.radiusProperty, model.object2.radiusProperty ],
( r1, r2 ) => {
this._radiusDifference = r1 - r2;
// max diff -1.0507898924466623
// min diff 0
}
);

Expand Down

0 comments on commit 0138c64

Please sign in to comment.