From dc0eeb2bedee5e6fc1412008eb452062dd0bca05 Mon Sep 17 00:00:00 2001 From: chrisklus Date: Wed, 15 Apr 2020 19:10:26 -0400 Subject: [PATCH] Uninstrument nameProperty for HomeScreen and single screen sims, see https://github.com/phetsims/joist/issues/627 --- js/HomeScreen.js | 3 ++- js/Screen.js | 13 ++++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/js/HomeScreen.js b/js/HomeScreen.js index 02495a95..ae458ff9 100644 --- a/js/HomeScreen.js +++ b/js/HomeScreen.js @@ -38,7 +38,8 @@ class HomeScreen extends Screen { //TODO get this color from LookAndFeel, see https://github.com/phetsims/joist/issues/255 backgroundColorProperty: new Property( BACKGROUND_COLOR ), - name: homeString + name: homeString, + instrumentNameProperty: false // requested by designers, see https://github.com/phetsims/joist/issues/627 }, options ); assert && assert( !options.tandem, 'tandem is a required constructor parameter, not an option' ); diff --git a/js/Screen.js b/js/Screen.js index 5014dc52..5f2de326 100644 --- a/js/Screen.js +++ b/js/Screen.js @@ -59,6 +59,9 @@ function Screen( createModel, createView, options ) { // For multi-screen sims, this must be provided. name: null, + // {boolean} whether nameProperty should be instrumented. see usage for explanation of its necessity. + instrumentNameProperty: true, + // {Property.} background color of the Screen backgroundColorProperty: new Property( 'white' ), @@ -120,14 +123,18 @@ function Screen( createModel, createView, options ) { // @public this.backgroundColorProperty = options.backgroundColorProperty; + // Don't instrument this.nameProperty if options.instrumentNameProperty is false or if options.name is not provided. + // This additional option is needed because designers requested the ability to not instrument a screen's nameProperty + // even if it has a name, see https://github.com/phetsims/joist/issues/627 and https://github.com/phetsims/joist/issues/629. + const instrumentNameProperty = options.instrumentNameProperty && options.name; + // @public (read-only) {Property} this.nameProperty = new Property( options.name, { phetioType: PropertyIO( NullableIO( StringIO ) ), - tandem: options.tandem.createTandem( 'nameProperty' ), + tandem: instrumentNameProperty ? options.tandem.createTandem( 'nameProperty' ) : Tandem.OPT_OUT, phetioFeatured: true, phetioDocumentation: 'The name of the screen. Changing this value will update the screen name for the screen\'s ' + - 'corresponding button on the navigation bar and home screen, if they exist. May be null for ' + - 'single-screen simulations.' + 'corresponding button on the navigation bar and home screen, if they exist.' } ); // @public (read-only)