Skip to content

Commit

Permalink
rename distance conversion function, conditionally use query paramete…
Browse files Browse the repository at this point in the history
…r, a11y string pattern update, see phetsims/gravity-force-lab#109
  • Loading branch information
mbarlow12 committed Dec 10, 2018
1 parent 5807066 commit 148ac75
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 15 deletions.
10 changes: 5 additions & 5 deletions js/ISLCA11yStrings.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,19 +56,19 @@ define( require => {
value: '{{label}} position'
},
spherePositionProgressObjectPattern: {
value: '{{position}} meter mark, {{progress}} {{otherObjectLabel}}.'
value: '{{position}} mark, {{progress}} {{otherObjectLabel}}.'
},
spherePositionProgressPattern: {
value: '{{position}} meter mark, {{progress}}.'
value: '{{position}} mark, {{progress}}.'
},
spherePositionRegionObjectPattern: {
value: '{{position}} meter mark, {{region}} {{otherObjectLabel}}.'
value: '{{position}} mark, {{region}} {{otherObjectLabel}}.'
},
spherePositionRegionPattern: {
value: '{{position}} meter mark, {{region}}.'
value: '{{position}} mark, {{region}}.'
},
spherePositionRegionLastStopPattern: {
value: '{{position}} meter mark, {{region}}, last stop.'
value: '{{position}} mark, {{region}}, last stop.'
},

/************************
Expand Down
6 changes: 3 additions & 3 deletions js/view/ISLCObjectNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -294,11 +294,11 @@ define( function( require ) {
} );

this.redrawForce();

var defaultStepSize = options.snapToNearest > 1 ? options.snapToNearest * 2 : ISLCQueryParameters.stepSize;
var accessibleSliderOptions = {
keyboardStep: ISLCQueryParameters.stepSize,
keyboardStep: defaultStepSize,
shiftKeyboardStep: options.snapToNearest,
pageKeyboardStep: ISLCQueryParameters.stepSize * 2,
pageKeyboardStep: defaultStepSize * 2,
accessibleDecimalPlaces: 1,
constrainValue: function( value ) {
return Util.toFixedNumber( value, 1 );
Expand Down
15 changes: 8 additions & 7 deletions js/view/ISLCStringManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ define( require => {
convertForceValue: value => `${value} newtons`,


convertDistanceApart: distance => distance
convertDistanceMetric: distance => distance
}, options );

// @private
Expand All @@ -172,7 +172,7 @@ define( require => {
this.object2 = model.object2;
this.object1Label = object1Label;
this.object2Label = object2Label;
this.convertDistanceApart = options.convertDistanceApart;
this.convertDistanceMetric = options.convertDistanceMetric;

this.object1ValueChangedAlertText = '';
this.object2ValueChangedAlertText = '';
Expand Down Expand Up @@ -240,7 +240,7 @@ define( require => {
object1Label: this.object1Label,
object2Label: this.object2Label,
qualitativeDistance: this.getQualitativeDistance(),
distance: this.convertDistanceApart( this._distanceBetween ),
distance: this.convertDistanceMetric( this._distanceBetween ),
distanceUnits: this._distanceUnits
};
return StringUtils.fillIn( distanceSpaceAndValueSummaryPatternString, fillObject );
Expand Down Expand Up @@ -283,9 +283,12 @@ define( require => {
}

getSpherePositionAndRegionText( position, objectEnum ) {
position = this.formatPositionUnitMark( position );
const otherObjectLabel = objectEnum === OBJECT_ONE ? this.object2Label : this.object1Label;
const region = RELATIVE_DISTANCE_STRINGS[ this.getDistanceIndex( this._distanceBetween ) ];
return StringUtils.fillIn( spherePositionRegionObjectPatternString, { position, otherObjectLabel, region } );
const units = this._distanceUnits;
const fillObject = { position, otherObjectLabel, region, units };
return StringUtils.fillIn( spherePositionRegionObjectPatternString, fillObject );
}

getSpherePositionAriaValueText( formattedPosition, objectNode ) {
Expand All @@ -294,9 +297,7 @@ define( require => {
const includeOtherObject = objectNode.interactionCount < 2;
const regionStringArray = includeOtherObject ? RELATIVE_DISTANCE_STRINGS : DISTANCE_STRINGS;
const progressStringArray = includeOtherObject ? RELATIVE_PROGRESS_STRINGS : PROGRESS_STRINGS;
const fillObject = {
position: formattedPosition
};
const fillObject = { position: this.formatPositionUnitMark( formattedPosition ) };

const objectPosition = thisObject.positionProperty.get();
const { min, max } = thisObject.enabledRangeProperty.get();
Expand Down

0 comments on commit 148ac75

Please sign in to comment.