From 7ab2d689926f116cb04cd73c2b1a03a9d0364686 Mon Sep 17 00:00:00 2001 From: Marla Schulz Date: Fri, 12 May 2023 10:20:21 -0700 Subject: [PATCH] Address TODO, see: https://github.com/phetsims/center-and-variability/issues/164 --- js/common/CAVConstants.ts | 4 +++- js/common/view/CAVScreenView.ts | 2 +- js/variability/view/VariabilityScreenView.ts | 6 ++++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/js/common/CAVConstants.ts b/js/common/CAVConstants.ts index c9844e33..05c5e734 100644 --- a/js/common/CAVConstants.ts +++ b/js/common/CAVConstants.ts @@ -68,7 +68,9 @@ const CAVConstants = { MAX_KICKS_PROPERTY: new NumberProperty( CAVQueryParameters.maxKicks, { validValues: [ 15, 20, 25, 30 ], tandem: Tandem.PREFERENCES.createTandem( 'maxKicksProperty' ) - } ) + } ), + + SCENE_VIEW_TANDEM: 'sceneView' }; centerAndVariability.register( 'CAVConstants', CAVConstants ); diff --git a/js/common/view/CAVScreenView.ts b/js/common/view/CAVScreenView.ts index d2542da0..c0d66fe3 100644 --- a/js/common/view/CAVScreenView.ts +++ b/js/common/view/CAVScreenView.ts @@ -103,7 +103,7 @@ export default class CAVScreenView extends ScreenView { ( soccerPlayer, sceneModel ) => this.getSoccerPlayerImageSet( soccerPlayer, sceneModel ), modelViewTransform, this.visibleBoundsProperty, { - tandem: options.tandem.createTandem( 'sceneView' + index ) + tandem: options.tandem.createTandem( CAVConstants.SCENE_VIEW_TANDEM + index ) } ) ); const createToggleNode = ( pickLayer: ( sceneView: SceneView ) => Node ) => new ToggleNode( model.selectedSceneModelProperty, this.sceneViews.map( sceneView => { diff --git a/js/variability/view/VariabilityScreenView.ts b/js/variability/view/VariabilityScreenView.ts index 99e3734e..3b03b938 100644 --- a/js/variability/view/VariabilityScreenView.ts +++ b/js/variability/view/VariabilityScreenView.ts @@ -120,9 +120,11 @@ export default class VariabilityScreenView extends CAVScreenView { model.variabilitySceneModels.forEach( ( sceneModel, index ) => { - // TODO: https://github.com/phetsims/center-and-variability/issues/164 Do we really want to create 12 of these? + // The infoDialog only exists in the VariabilityScreen, so having CAVScreenView be in charge of creating custom subclasses + // of CAVSceneView is overcomplicated and unnecessary. Instead, we create an equivalent tandem, so that it will appear + // under the appropriate sceneView in the studio tree. const infoDialog = new InfoDialog( model, sceneModel, { - tandem: options.tandem.createTandem( 'scene' + index ).createTandem( 'infoDialog' ) + tandem: options.tandem.createTandem( CAVConstants.SCENE_VIEW_TANDEM + index ).createTandem( 'infoDialog' ) } ); Multilink.multilink( [ model.isInfoVisibleProperty, sceneModel.isVisibleProperty ],