From 89a8c43e86c91d2cbf353ef9b444ec3d7dc567d5 Mon Sep 17 00:00:00 2001 From: zepumph Date: Mon, 4 Nov 2019 15:42:35 -0900 Subject: [PATCH] add edge alerts for min/max mass interaction attempt, https://github.com/phetsims/gravity-force-lab/issues/155 --- js/ISLCA11yStrings.js | 5 ++++- js/view/describers/ForceDescriber.js | 22 ++++++++++++++++------ 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/js/ISLCA11yStrings.js b/js/ISLCA11yStrings.js index 31827b7..b7180b0 100644 --- a/js/ISLCA11yStrings.js +++ b/js/ISLCA11yStrings.js @@ -66,8 +66,11 @@ define( require => { forceMagnitude: { value: 'Force magnitude' }, + forceVectorSizePattern: { + value: '{{forceVector}} is {{size}}' + }, forceAndVectorPattern: { - value: '{{forceVector}} is {{size}}, and points directly at {{otherObjectLabel}}.' + value: '{{forceVectorSize}}, and points directly at {{otherObjectLabel}}.' }, forceVector: { value: 'Force vector' diff --git a/js/view/describers/ForceDescriber.js b/js/view/describers/ForceDescriber.js index acb4b50..30ece53 100644 --- a/js/view/describers/ForceDescriber.js +++ b/js/view/describers/ForceDescriber.js @@ -27,6 +27,7 @@ define( require => { const summaryVectorSizeValueUnitsPatternString = ISLCA11yStrings.summaryVectorSizeValueUnitsPattern.value; const forceVectorMagnitudeUnitsPatternString = ISLCA11yStrings.forceVectorMagnitudeUnitsPattern.value; const forceAndVectorPatternString = ISLCA11yStrings.forceAndVectorPattern.value; + const forceVectorSizePatternString = ISLCA11yStrings.forceVectorSizePattern.value; const robotPullSummaryPatternString = ISLCA11yStrings.robotPullSummaryPattern.value; const robotPushSummaryPatternString = ISLCA11yStrings.robotPushSummaryPattern.value; const vectorsString = ISLCA11yStrings.vectors.value; @@ -166,7 +167,7 @@ define( require => { this.forceVectorMagnitudeUnitsPatternString = StringUtils.fillIn( forceVectorMagnitudeUnitsPatternString, { forceMagnitude: options.forceMagnitudeString } ); - this.forceAndVectorPatternString = StringUtils.fillIn( forceAndVectorPatternString, { + this.forceVectorSizePatternString = StringUtils.fillIn( forceVectorSizePatternString, { forceVector: options.forceVectorString } ); @@ -228,6 +229,17 @@ define( require => { } ); } + /** + * Get the size of the vectors clause. + * @public + * @returns {string} + */ + getForceVectorSize() { + return StringUtils.fillIn( this.forceVectorSizePatternString, { + size: this.getVectorSize() + } ); + } + /** * @param {string} thisObjectLabel * @param {string} otherObjectLabel @@ -235,13 +247,11 @@ define( require => { * @public */ getForceBetweenAndVectorText( thisObjectLabel, otherObjectLabel ) { - const pattern = this.forceAndVectorPatternString; - const fillObject = { + return StringUtils.fillIn( forceAndVectorPatternString, { thisObjectLabel: thisObjectLabel, otherObjectLabel: otherObjectLabel, - size: this.getVectorSize() - }; - return StringUtils.fillIn( pattern, fillObject ); + forceVectorSize: this.getForceVectorSize() + } ); } /**