Skip to content

Commit

Permalink
Uninstrument nameProperty for HomeScreen and single screen sims, see #…
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisklus committed Apr 15, 2020
1 parent 720363f commit dc0eeb2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
3 changes: 2 additions & 1 deletion js/HomeScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -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' );
Expand Down
13 changes: 10 additions & 3 deletions js/Screen.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.<Color|string>} background color of the Screen
backgroundColorProperty: new Property( 'white' ),

Expand Down Expand Up @@ -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<String|null>}
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)
Expand Down

0 comments on commit dc0eeb2

Please sign in to comment.