Skip to content

Commit

Permalink
update distance summary bullet in summary, phetsims/gravity-force-lab…
Browse files Browse the repository at this point in the history
  • Loading branch information
zepumph committed Feb 26, 2019
1 parent b576d1e commit 7431c5b
Showing 1 changed file with 14 additions and 15 deletions.
29 changes: 14 additions & 15 deletions js/gravity-force-lab/view/GravityForceLabScreenSummaryNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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();
}
Expand All @@ -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
Expand Down

0 comments on commit 7431c5b

Please sign in to comment.