From 7431c5b71b602e065bf9184ec8e98ce83709f2f7 Mon Sep 17 00:00:00 2001 From: zepumph Date: Tue, 26 Feb 2019 11:56:34 -0900 Subject: [PATCH] update distance summary bullet in summary, https://github.com/phetsims/gravity-force-lab-basics/issues/100 --- .../view/GravityForceLabScreenSummaryNode.js | 29 +++++++++---------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/js/gravity-force-lab/view/GravityForceLabScreenSummaryNode.js b/js/gravity-force-lab/view/GravityForceLabScreenSummaryNode.js index 6a2489ae..0c50c959 100644 --- a/js/gravity-force-lab/view/GravityForceLabScreenSummaryNode.js +++ b/js/gravity-force-lab/view/GravityForceLabScreenSummaryNode.js @@ -30,35 +30,37 @@ define( require => { class GravityForceLabScreenSummaryNode extends Node { + /** + * @param {ISLCModel} model + * @param {Object} [options] + */ constructor( model, options ) { options = _.extend( { + // {{Property[]}} - a way to provide extra Properties to that will update the mass and distance summary sections + // on change + additionalMassDistanceProperties: [], + // {string} mainDescriptionContent: screenSummaryMainDescriptionString, // {sring} - secondaryDecriptionContent: screenSummarySecondaryDescriptionString, + secondaryDescriptionContent: screenSummarySecondaryDescriptionString, // {string} - simStateLabel: simStateListLabelString, - - // {boolean} GFLB has simplified language, this flag is to support that, see https://github.com/phetsims/gravity-force-lab-basics/issues/86 - simplifyLanguage: false + simStateLabel: simStateListLabelString }, options ); super(); - // @private - this.simplifyLanguage = options.simplifyLanguage; - // subtypes of ForceDescriber initialize the singleton to the appropriate subtype this.forceDescriber = ForceDescriber.getDescriber(); this.positionDescriber = PositionDescriber.getDescriber(); this.massDescriber = MassDescriber.getDescriber(); var mainSummaryDescriptionNode = new Node( { tagName: 'p', innerContent: options.mainDescriptionContent } ); - var secondSummaryDescriptionNode = new Node( { tagName: 'p', innerContent: options.secondaryDecriptionContent } ); + var secondSummaryDescriptionNode = new Node( { tagName: 'p', innerContent: options.secondaryDescriptionContent } ); this.simStateNode = new Node( { tagName: 'ul', @@ -103,9 +105,8 @@ define( require => { [ model.object1.positionProperty, model.object1.radiusProperty, model.object2.positionProperty, - model.object2.radiusProperty - ], - ( x1, r1, x2, r2 ) => { + model.object2.radiusProperty ].concat( options.additionalMassDistanceProperties ), + () => { this.updateObjectDistanceSummary(); this.updateMassValuesSummary(); } @@ -131,9 +132,7 @@ define( require => { // @private updateObjectDistanceSummary() { - - const distanceSummary = this.positionDescriber.getObjectDistanceSummary( this.simplifyLanguage ); - this.objectDistanceSummaryItem.innerContent = distanceSummary; + this.objectDistanceSummaryItem.innerContent = this.positionDescriber.getObjectDistanceSummary(); } // @private