Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
zepumph committed Sep 20, 2019
1 parent 1ca8cbe commit 839a5a0
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 59 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ define( require => {
const twoBalloonInitialMovementPatternString = BASEA11yStrings.twoBalloonInitialMovementPattern.value;
const twoBalloonNoChangeAndLocationPatternString = BASEA11yStrings.twoBalloonNoChangeAndLocationPattern.value;
const twoBalloonNowDirectionPatternString = BASEA11yStrings.twoBalloonNowDirectionPattern.value;
const extremelySlowlyString = BASEA11yStrings.extremelySlowly.value;
const extremelySlowlyString = BASEA11yStrings.extremelySlowly.value;
const verySlowlyString = BASEA11yStrings.verySlowly.value;
const slowlyString = BASEA11yStrings.slowly.value;
const quicklyString = BASEA11yStrings.quickly.value;
Expand Down Expand Up @@ -128,11 +128,11 @@ define( require => {
description: verySlowlyString
},
SLOWLY_RANGE: {
range: new Range( MAXIMUM_VELOCITY_ON_RELEASE / 100, MAXIMUM_VELOCITY_ON_RELEASE / 50 ),
range: new Range( MAXIMUM_VELOCITY_ON_RELEASE / 100, MAXIMUM_VELOCITY_ON_RELEASE / 50 ),
description: slowlyString
},
QUICKLY_RANGE: {
range: new Range( MAXIMUM_VELOCITY_ON_RELEASE / 50, MAXIMUM_VELOCITY_ON_RELEASE / 4 ),
range: new Range( MAXIMUM_VELOCITY_ON_RELEASE / 50, MAXIMUM_VELOCITY_ON_RELEASE / 4 ),
description: quicklyString
},
VERY_QUICKLY_RANGE: {
Expand Down Expand Up @@ -243,11 +243,11 @@ define( require => {
*/
getAttractiveStateAndLocationDescription: function() {
const locationDescriptionString = this.getBalloonLocationDescription();

const attractiveStateDescriptionString = this.getAttractiveStateOrProximityDescription();
const attractiveStateAndLocationString = StringUtils.fillIn( balloonLocationAttractiveStatePatternString, {
attractiveState: attractiveStateDescriptionString,
location: locationDescriptionString
location: locationDescriptionString
} );

return attractiveStateAndLocationString;
Expand All @@ -261,11 +261,10 @@ define( require => {
* @returns {string}
*/
getAttractiveStateAndLocationDescriptionWithLabel: function() {
let alert;

// to lower case since it is used elsewhere in the string
const location = this.getAttractiveStateAndLocationDescription().toLowerCase();
alert = StringUtils.fillIn( balloonLabelWithAttractiveStatePatternString, {
const alert = StringUtils.fillIn( balloonLabelWithAttractiveStatePatternString, {
balloonLabel: this.accessibleName,
attractiveStateAndLocation: location
} );
Expand Down Expand Up @@ -299,8 +298,8 @@ define( require => {
* "next to {{balloon label}}" is added. Will return someting like
*
* "center of play area" or
* "upper wall", or
* "wall, next to Green Balloon", or
* "upper wall", or
* "wall, next to Green Balloon", or
* "right arm of sweater, next to Yellow Balloon"
*
* @returns {string}
Expand Down Expand Up @@ -363,7 +362,7 @@ define( require => {
* @returns {string}
*/
getTouchingBoundaryDescription: function( attemptedDirection ) {
assert && assert ( this.balloonModel.isTouchingBoundary(), 'balloon is not touching a boundary' );
assert && assert( this.balloonModel.isTouchingBoundary(), 'balloon is not touching a boundary' );

let boundaryString;
if ( this.balloonModel.isTouchingBottomBoundary() && attemptedDirection === BalloonDirectionEnum.DOWN ) {
Expand All @@ -375,14 +374,14 @@ define( require => {
else if ( this.balloonModel.touchingWall() && attemptedDirection === BalloonDirectionEnum.RIGHT ) {
boundaryString = atWallString;
}
else if ( this.balloonModel.isTouchingRightEdge() && attemptedDirection === BalloonDirectionEnum.RIGHT) {
else if ( this.balloonModel.isTouchingRightEdge() && attemptedDirection === BalloonDirectionEnum.RIGHT ) {
boundaryString = atRightEdgeString;
}
else if ( this.balloonModel.isTouchingTopBoundary() && attemptedDirection === BalloonDirectionEnum.UP ) {
boundaryString = atTopString;
}

assert && assert ( boundaryString, 'No boundary string found for balloon.' );
assert && assert( boundaryString, 'No boundary string found for balloon.' );
return boundaryString;
},

Expand Down Expand Up @@ -496,8 +495,8 @@ define( require => {
* Generally announced right after the balloon as been released, this is read as an alert. Dependent on whether
* both balloons are visible. If they are, the label of the released balloon is read prior to the rest of the
* alert. Will generate something like
*
* "Moves extremely slowly left." or
*
* "Moves extremely slowly left." or
* "Yellow balloon, moves slowly left."
*
* @param {Vector2} location - the current location of the balloon
Expand All @@ -508,7 +507,7 @@ define( require => {

// the balloon is moving with some initial velocity, describe that
const velocityString = this.getVelocityString();
const directionString= this.getReleaseDirectionDescription( this.balloonModel.directionProperty.get() );
const directionString = this.getReleaseDirectionDescription( this.balloonModel.directionProperty.get() );

let description;
if ( this.model.bothBalloonsVisible() ) {
Expand All @@ -522,7 +521,7 @@ define( require => {
description = StringUtils.fillIn( initialMovementPatternString, {
velocity: velocityString,
direction: directionString
} );
} );
}

return description;
Expand Down Expand Up @@ -621,7 +620,7 @@ define( require => {

/**
* Get a description of velocity for this balloon, one of "very slowly", "slowly", "quickly", "very quickly"
*
*
* @private
* @returns {string}
*/
Expand Down Expand Up @@ -661,7 +660,7 @@ define( require => {
/**
* Get a description of the balloon movement direction when the balloon is not currently
* being dragged.
*
*
* @param {string} direction - one of BalloonDirectionEnum
*/
getReleaseDirectionDescription: function( direction ) {
Expand All @@ -687,7 +686,7 @@ define( require => {

return StringUtils.fillIn( balloonNewRegionPatternString, {
nearOrAt: nearOrAt,
location: locationString
location: locationString
} );
},

Expand All @@ -697,7 +696,6 @@ define( require => {
* @returns {string}
*/
getPlayAreaDragProgressDescription: function() {
let alert;
let nearestObjectString;

const centerPlayAreaX = PlayAreaMap.X_LOCATIONS.AT_CENTER_PLAY_AREA;
Expand Down Expand Up @@ -736,7 +734,7 @@ define( require => {
}

assert && assert( nearestObjectString, 'no nearest object found for movement direction: ' + balloonDirection );
alert = StringUtils.fillIn( closerToObjectPatternString, {
const alert = StringUtils.fillIn( closerToObjectPatternString, {
object: nearestObjectString
} );

Expand Down Expand Up @@ -767,7 +765,7 @@ define( require => {

// when not dragged, add 'Now' to direction
const directionString = this.getReleaseDirectionDescription( direction );
if ( this.model.bothBalloonsVisible() ) {
if ( this.model.bothBalloonsVisible() ) {
description = StringUtils.fillIn( twoBalloonNowDirectionPatternString, {
balloon: this.accessibleName,
direction: directionString
Expand Down Expand Up @@ -873,7 +871,7 @@ define( require => {
chargeDescription = this.balloonDescriber.chargeDescriber.getHasRelativeChargeDescription();
}

chargeDescription = StringUtils.fillIn( singleStatementPatternString, {
chargeDescription = StringUtils.fillIn( singleStatementPatternString, {
statement: chargeDescription
} );

Expand Down Expand Up @@ -905,7 +903,7 @@ define( require => {
if ( !this.balloonModel.successfulPickUp ) {
description = StringUtils.fillIn( grabbedWithHelpPatternString, {
grabbedAlert: description,
help: interactionCueString
help: interactionCueString
} );
}

Expand Down Expand Up @@ -944,7 +942,7 @@ define( require => {
const showCharges = this.model.showChargesProperty.get();

// if jumping to wall, describe as if balloon is rubbing along the wall for the first time
if ( this.balloonModel.touchingWallProperty.get() && showCharges !== 'none') {
if ( this.balloonModel.touchingWallProperty.get() && showCharges !== 'none' ) {
if ( showCharges === 'all' ) {

// describer pairs of charges in the wall if they are visible
Expand All @@ -955,7 +953,7 @@ define( require => {
}
}
else if ( wallVisible && inducingCharge && showCharges === 'all' ) {

// if there is an induced charge and the charges are visible, describe induced charge summary
const inducedChargeDescription = WallDescriber.getInducedChargeDescriptionWithNoAmount( this.balloonModel, this.accessibleName, wallVisible );
description = StringUtils.fillIn( locationAndInducedChargePatternString, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

/**
* A view type that presents the accessibility descriptions for the Sweater.
*
*
* @author Jesse Greenberg
*/

Expand Down Expand Up @@ -51,7 +51,7 @@ define( require => {

/**
* Manages all descriptions relating to the sweater.
*
*
* @param {BASEModel} model
* @param {Sweater} sweaterModel
*/
Expand All @@ -66,7 +66,7 @@ define( require => {

/**
* Get the descrition of the sweater, which includes its position in the play area, its net charge, and its
* relative proportion of positive and negative charges. Will be dependent on what charges are visible.
* relative proportion of positive and negative charges. Will be dependent on what charges are visible.
* "At left edge of Play Area. Has positive net charge, a few more positive charges than negative charges." or
* "At left edge of Play Area. Has positive net charge, showing all positive charges." or
* "At left edge of Play Area. Has positive net charge, no more negative charges, only positive charges." or
Expand All @@ -76,7 +76,6 @@ define( require => {
* @returns {string}
*/
getSweaterDescription: function( showCharges ) {
let description;

// if we are not showing any charges, just return a description for the location
if ( showCharges === 'none' ) {
Expand Down Expand Up @@ -118,7 +117,7 @@ define( require => {
chargeString = showingAllPositiveChargesString;
}
else {
chargeString = StringUtils.fillIn( sweaterRelativeChargeDifferencesPatternString, {
chargeString = StringUtils.fillIn( sweaterRelativeChargeDifferencesPatternString, {
charge: relativeChargeString
} );
}
Expand All @@ -131,7 +130,7 @@ define( require => {
} );

// full description, without punctuation
description = StringUtils.fillIn( sweaterDescriptionPatternString, {
const description = StringUtils.fillIn( sweaterDescriptionPatternString, {
location: sweaterLocationString,
charge: chargeString
} );
Expand All @@ -149,10 +148,10 @@ define( require => {
* "Sweater has several more positive charges than negative charges." or
* "Sweater has positive net charge, showing several positive charges." or
* "Sweater has no more negative charges, only positive charges."
*
*
* @param {number} charge
* @param {string} shownCharges
* @returns {string}
* @returns {string}
*/
getRelativeChargeDescriptionWithLabel: function( charge, shownCharges ) {
let description;
Expand Down Expand Up @@ -205,7 +204,7 @@ define( require => {
getRelativeChargeDescription: function( charge ) {

if ( charge === BASEConstants.MAX_BALLOON_CHARGE ) {
return allString;
return allString;
}
else {
return BASEDescriber.getRelativeChargeDescription( charge );
Expand All @@ -215,15 +214,15 @@ define( require => {
/**
* Get an alert describing the sweater when it runs out of charges. Dependent on the
* charge visibility.
*
*
* @param {string} shownCharges
* @returns {string}
*/
getNoMoreChargesAlert: function( charge, shownCharges ) {
let alert;
if ( shownCharges === 'all' ) {
alert = StringUtils.fillIn( sweaterHasRelativeChargePatternString, {
relativeCharge: sweaterNoMoreChargesString
relativeCharge: sweaterNoMoreChargesString
} );
}
else if ( shownCharges === 'diff' ) {
Expand All @@ -241,7 +240,7 @@ define( require => {
* @param {number} sweaterCharge
* @returns {string}
*/
getNetChargeDescription: function( sweaterCharge ) {
getNetChargeDescription: function( sweaterCharge ) {
const relativeChargeString = ( sweaterCharge === 0 ) ? neutralNetChargeString : positiveNetChargeString;
return StringUtils.fillIn( sweaterHasRelativeChargePatternString, {
relativeCharge: relativeChargeString
Expand Down Expand Up @@ -282,18 +281,18 @@ define( require => {
if ( shownCharges === 'all' ) {
moreChargesString = morePairsOfChargesString;
}
else if ( shownCharges === 'diff' ) {
else if ( shownCharges === 'diff' ) {
moreChargesString = moreHiddenPairsOfChargesString;
}

return StringUtils.fillIn( patternString, {
moreCharges: moreChargesString,
moreCharges: moreChargesString,
direction: directionDescription
} );
},

/**
* Get a description of the sweater's charge for the screen summary. Will return something like
* Get a description of the sweater's charge for the screen summary. Will return something like
* "Sweater has positive net charge, a few more positive charges than negative charges."
* "Sweater has positive net charge, showing a few positive charges."
* "Sweater has zero net charge, many pairs of positive and negative charges."
Expand All @@ -315,13 +314,13 @@ define( require => {
const relativeChargeString = BASEDescriber.getRelativeChargeDescription( charge );
if ( chargesShown === 'all' ) {
chargeString = ( charge === 0 ) ?
StringUtils.fillIn( summaryNeutralChargesPatternString, { amount: manyString } ) :
StringUtils.fillIn( sweaterRelativeChargePatternString, { charge: relativeChargeString } );
StringUtils.fillIn( summaryNeutralChargesPatternString, { amount: manyString } ) :
StringUtils.fillIn( sweaterRelativeChargePatternString, { charge: relativeChargeString } );
}
else if ( chargesShown === 'diff' ) {
chargeString = ( charge === 0 ) ?
showingNoChargesString :
chargeString = StringUtils.fillIn( sweaterShowingPatternString, { charge: relativeChargeString } );
showingNoChargesString :
chargeString = StringUtils.fillIn( sweaterShowingPatternString, { charge: relativeChargeString } );
}

return StringUtils.fillIn( summaryObjectChargePatternString, {
Expand Down
Loading

0 comments on commit 839a5a0

Please sign in to comment.