Skip to content

Commit

Permalink
proper string handling, todos addressed, static text getter functions…
Browse files Browse the repository at this point in the history
  • Loading branch information
mbarlow12 committed Oct 31, 2018
1 parent 3bbcca0 commit 774b337
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 6 deletions.
9 changes: 9 additions & 0 deletions js/ISLCA11yStrings.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,15 @@ define( require => {
forceAndVectorPattern: {
value: 'Force on {{thisObject}} by {{otherObject}} is {{size}}, and vector points directly at {{otherObject}}.'
},
positionMeterMarkPattern: {
value: '{{position}} meter mark'
},
valueKilogramsPattern: {
value: '{{value}} kilograms'
},
objectLabelPositionPattern: {
value: '{{label}} position'
},

/**********************
* Qualitative Values *
Expand Down
1 change: 0 additions & 1 deletion js/view/ISLCCheckboxItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ define( function( require ) {
} );

// a11y
// TODO: review a11y implemntation ('accessibility' key in array)
Checkbox.call( this, content, property, _.pick( options, [ 'boxWidth', 'tandem', 'accessibleName' ] ) );
}

Expand Down
1 change: 0 additions & 1 deletion js/view/ISLCObjectControlPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ define( function( require ) {
align: 'right',

// a11y
// TODO: REVIEW this
tagName: 'li',

numberControlOptions: {},
Expand Down
4 changes: 2 additions & 2 deletions js/view/ISLCObjectNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ define( function( require ) {
var inverseSquareLawCommon = require( 'INVERSE_SQUARE_LAW_COMMON/inverseSquareLawCommon' );
var ISLCForceArrowNode = require( 'INVERSE_SQUARE_LAW_COMMON/view/ISLCForceArrowNode' );
var ISLCPullerNode = require( 'INVERSE_SQUARE_LAW_COMMON/view/ISLCPullerNode' );
var ISLCStringManager = require( 'INVERSE_SQUARE_LAW_COMMON/view/ISLCStringManager' );
var Node = require( 'SCENERY/nodes/Node' );
var Path = require( 'SCENERY/nodes/Path' );
var PhetFont = require( 'SCENERY_PHET/PhetFont' );
Expand Down Expand Up @@ -124,9 +125,8 @@ define( function( require ) {
} );

// A11Y DRAFT
// TODO: refactor
assert && assert( options.createAriaValueText, 'ISLCObjectNode subtypes must define an aria-valuetext creation function' );
this.accessibleName = `${options.label} position`;
this.accessibleName = ISLCStringManager.getObjectLabelPositionText( options.label );

// @protected
this.layoutBounds = layoutBounds;
Expand Down
12 changes: 10 additions & 2 deletions js/view/ISLCStringManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ define( require => {
// const spherePositionHelpTextString = ISLCA11yStrings.spherePositionHelpText.value;
const forceVectorMagnitudePatternString = ISLCA11yStrings.forceVectorMagnitudePattern.value;
const forceAndVectorPatternString = ISLCA11yStrings.forceAndVectorPattern.value;
const positionMeterMarkPatternString = ISLCA11yStrings.positionMeterMarkPattern.value;
const objectLabelPositionPatternString = ISLCA11yStrings.objectLabelPositionPattern.value;

const tinyString = ISLCA11yStrings.tiny.value;
const verySmallString = ISLCA11yStrings.verySmall.value;
Expand All @@ -36,7 +38,6 @@ define( require => {
const veryLargeString = ISLCA11yStrings.veryLarge.value;
const hugeString = ISLCA11yStrings.huge.value;


const extremelyFarFromString = ISLCA11yStrings.extremelyFarFrom.value;
const veryFarFromString = ISLCA11yStrings.veryFarFrom.value;
const notSoFarFromString = ISLCA11yStrings.notSoFarFrom.value;
Expand All @@ -54,7 +55,6 @@ define( require => {
const aLittleString = ISLCA11yStrings.aLittle.value;
const aTinyBitString = ISLCA11yStrings.aTinyBit.value;

// TODO: create type to handle string arrays mapped from a given value
const SIZE_STRINGS = [
tinyString,
verySmallString,
Expand Down Expand Up @@ -192,6 +192,14 @@ define( require => {
return StringUtils.fillIn( pattern, fillObject );
}

static getPositionMeterMarkText( position ) {
return StringUtils.fillIn( positionMeterMarkPatternString, { position } );
}

static getObjectLabelPositionText( label ) {
return StringUtils.fillIn( objectLabelPositionPatternString, { label } );
}

getSizeFromIndex( index ) {
return SIZE_STRINGS[ index ];
}
Expand Down

0 comments on commit 774b337

Please sign in to comment.