From fabcd5e0286311cd6710d1fe06fc6c915e4e3d50 Mon Sep 17 00:00:00 2001 From: zepumph Date: Tue, 26 Feb 2019 15:42:27 -0900 Subject: [PATCH] create SpherePositionsPDOMHeading and refactor duplicated code to that type, see https://github.com/phetsims/gravity-force-lab-basics/issues/101 --- js/gravity-force-lab-basics/view/GFLBScreenView.js | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/js/gravity-force-lab-basics/view/GFLBScreenView.js b/js/gravity-force-lab-basics/view/GFLBScreenView.js index a6d1e50..345378d 100644 --- a/js/gravity-force-lab-basics/view/GFLBScreenView.js +++ b/js/gravity-force-lab-basics/view/GFLBScreenView.js @@ -40,6 +40,7 @@ define( require => { const PlayAreaNode = require( 'SCENERY_PHET/accessibility/nodes/PlayAreaNode' ); const ResetAllButton = require( 'SCENERY_PHET/buttons/ResetAllButton' ); const ScreenView = require( 'JOIST/ScreenView' ); + const SpherePositionsPDOMHeading = require( 'GRAVITY_FORCE_LAB/gravity-force-lab/view/SpherePositionsPDOMHeading' ); const StringUtils = require( 'PHETCOMMON/util/StringUtils' ); const Vector2 = require( 'DOT/Vector2' ); @@ -64,7 +65,6 @@ define( require => { // a11y strings const mass1ControlLabelString = require( 'string!GRAVITY_FORCE_LAB_BASICS/mass1ControlLabel' ); const mass2ControlLabelString = require( 'string!GRAVITY_FORCE_LAB_BASICS/mass2ControlLabel' ); - const spherePositionsString = ISLCA11yStrings.spherePositions.value; const spherePositionHelpTextString = ISLCA11yStrings.spherePositionHelpText.value; const massControlsLabelString = GravityForceLabA11yStrings.massControlsLabel.value; const massControlsHelpTextBillionsString = GravityForceLabA11yStrings.massControlsHelpTextBillions.value; @@ -143,12 +143,8 @@ define( require => { playAreaNode.addChild( new GFLBMassPDOMNode( model, OBJECT_ONE, massPDOMNodeOptions ) ); playAreaNode.addChild( new GFLBMassPDOMNode( model, OBJECT_TWO, massPDOMNodeOptions ) ); - const massPositionsNode = new Node( { - tagName: 'ul', - labelTagName: 'h3', - labelContent: spherePositionsString - // NOTE: descriptionContent set below - } ); + const massPositionsNode = new SpherePositionsPDOMHeading(); + model.distanceProperty.link( distance => { massPositionsNode.descriptionContent = StringUtils.fillIn( spherePositionsDescriptionPatternString, {