From f10e3b2eb31fc697869385f1af3e3b0184cdb99a Mon Sep 17 00:00:00 2001 From: zepumph Date: Mon, 18 Nov 2019 14:39:38 -0900 Subject: [PATCH] refactor children in CL, https://github.com/phetsims/gravity-force-lab/issues/104 --- js/common/view/CoulombsLawCommonView.js | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/js/common/view/CoulombsLawCommonView.js b/js/common/view/CoulombsLawCommonView.js index 92a6730..6f96af6 100644 --- a/js/common/view/CoulombsLawCommonView.js +++ b/js/common/view/CoulombsLawCommonView.js @@ -85,7 +85,6 @@ define( require => { 'moveOnHoldDelay', 'moveOnHoldInterval' ] ) ); - this.addChild( coulombsLawRuler ); // construct checkbox item list const checkboxItems = [ @@ -109,8 +108,6 @@ define( require => { bottom: bottomAlignment - 73 } ); - this.addChild( coulombsLawParameterCheckbox ); - const charge1Control = new ChargeControl( charge1String, unitString, @@ -122,8 +119,6 @@ define( require => { charge1Control.right = this.layoutBounds.centerX - 5; charge1Control.top = coulombsLawParameterCheckbox.top; - this.addChild( charge1Control ); - const charge2Control = new ChargeControl( charge2String, unitString, @@ -138,8 +133,6 @@ define( require => { charge2Control.left = this.layoutBounds.centerX + 5; charge2Control.top = coulombsLawParameterCheckbox.top; - this.addChild( charge2Control ); - // Reset All button // buttons are never disposed in this sim const resetAllButton = new ResetAllButton( { @@ -154,7 +147,16 @@ define( require => { bottom: bottomAlignment, tandem: tandem.createTandem( 'resetAllButton' ) } ); - this.addChild( resetAllButton ); + + this.children = [ + coulombsLawRuler, + coulombsLawParameterCheckbox, + charge1Control, + charge2Control, + + + resetAllButton + ]; // a11y - accessible order of controls, charge objects will come first in subtypes this.pdomPlayAreaNode.accessibleOrder = [