Skip to content

Commit

Permalink
Move screenViewRoot to base class, see: https://github.com/phetsims/m…
Browse files Browse the repository at this point in the history
  • Loading branch information
marlitas committed Sep 6, 2022
1 parent a0c96e0 commit 9d0ae46
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
7 changes: 4 additions & 3 deletions js/common/view/MeanShareAndBalanceScreenView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export type MeanShareAndBalanceScreenViewOptions = PickRequired<ScreenViewOption
export default class MeanShareAndBalanceScreenView extends ScreenView {
public readonly resetAllButton: ResetAllButton;
public readonly questionBar: QuestionBar;
public readonly screenViewRootNode: Node;

protected constructor( model: MeanShareAndBalanceModel, questionBarTextProperty: TReadOnlyProperty<string>, questionBarColor: TColor, providedOptions: MeanShareAndBalanceScreenViewOptions ) {
const options = providedOptions;
Expand Down Expand Up @@ -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 );
}

/**
Expand Down
9 changes: 4 additions & 5 deletions js/intro/view/IntroScreenView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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 );
Expand Down

0 comments on commit 9d0ae46

Please sign in to comment.