From 9d0ae46408d485c7aea0ddb7befa7661d4e2cf05 Mon Sep 17 00:00:00 2001 From: Marla Schulz Date: Tue, 6 Sep 2022 16:22:43 -0700 Subject: [PATCH] Move screenViewRoot to base class, see: https://github.com/phetsims/mean-share-and-balance/issues/76` --- js/common/view/MeanShareAndBalanceScreenView.ts | 7 ++++--- js/intro/view/IntroScreenView.ts | 9 ++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/js/common/view/MeanShareAndBalanceScreenView.ts b/js/common/view/MeanShareAndBalanceScreenView.ts index 692fb601..48d4bfb5 100644 --- a/js/common/view/MeanShareAndBalanceScreenView.ts +++ b/js/common/view/MeanShareAndBalanceScreenView.ts @@ -24,6 +24,7 @@ export type MeanShareAndBalanceScreenViewOptions = PickRequired, questionBarColor: TColor, providedOptions: MeanShareAndBalanceScreenViewOptions ) { const options = providedOptions; @@ -51,13 +52,13 @@ export default class MeanShareAndBalanceScreenView extends ScreenView { tandem: options.tandem.createTandem( 'resetAllButton' ) } ); - const screenViewRootNode = new Node( { + this.screenViewRootNode = new Node( { children: [ this.questionBar, this.resetAllButton ] } ); - screenViewRootNode.pdomOrder = [ ...this.children, this.questionBar ]; + this.screenViewRootNode.pdomOrder = [ ...this.children, this.questionBar ]; - this.addChild( screenViewRootNode ); + this.addChild( this.screenViewRootNode ); } /** diff --git a/js/intro/view/IntroScreenView.ts b/js/intro/view/IntroScreenView.ts index 6ee34c8d..0f9cbaf8 100644 --- a/js/intro/view/IntroScreenView.ts +++ b/js/intro/view/IntroScreenView.ts @@ -153,9 +153,9 @@ export default class IntroScreenView extends MeanShareAndBalanceScreenView { this.interruptSubtreeInput(); } ); - const screenViewRootNode = new Node( { - children: [ tableNode, chocolateLayerNode, predictMeanSlider ] - } ); + this.screenViewRootNode.addChild( tableNode ); + this.screenViewRootNode.addChild( chocolateLayerNode ); + this.screenViewRootNode.addChild( predictMeanSlider ); // Only travel to the first pipe in pdomOrder const chocolateLayerChildren = chocolateLayerNode.children; @@ -166,8 +166,7 @@ export default class IntroScreenView extends MeanShareAndBalanceScreenView { } } ); - screenViewRootNode.pdomOrder = [ ...chocolateLayerChildren, controlPanel, predictMeanSlider ]; - this.addChild( screenViewRootNode ); + this.screenViewRootNode.pdomOrder = [ ...chocolateLayerChildren, controlPanel, predictMeanSlider ]; const pipeBoundsShapes = pipeNodes.map( pipe => Shape.bounds( pipe.bounds ) ); pipeNodes[ 0 ].focusHighlight = Shape.union( pipeBoundsShapes );