Skip to content

Commit

Permalink
Instrument ProjectorModeCheckbox, see phetsims/sun#501 and phetsims/b…
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisklus committed Apr 23, 2019
1 parent 03a0ede commit ba1c1aa
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions js/ProjectorModeCheckbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ define( require => {
const Checkbox = require( 'SUN/Checkbox' );
const joist = require( 'JOIST/joist' );
const OptionsDialog = require( 'JOIST/OptionsDialog' );
const Tandem = require( 'TANDEM/Tandem' );
const Text = require( 'SCENERY/nodes/Text' );

// strings
Expand All @@ -32,15 +33,25 @@ define( require => {
maxTextWidth: 350, // empirically determined, works reasonably well for long strings

// property that can be used for setting the projector mode, created below if not supplied
projectorModeEnabledProperty: null
projectorModeEnabledProperty: null,

tandem: Tandem.required
}, options );

// Does this instance own projectorModeEnabledProperty?
const ownsProjectorModeEnabledProperty = !options.projectorModeEnabledProperty;

// superclass option that the client cannot set
assert && assert( options.phetioLinkProperty === undefined, 'ProjectorModeCheckbox sets phetioLinkProperty' );
options = _.extend( {
phetioLinkProperty: !ownsProjectorModeEnabledProperty
}, options );

// @public {BooleanProperty} - projector mode state, create one if not provided
const projectorModeEnabledProperty = options.projectorModeEnabledProperty ||
new BooleanProperty( phet.chipper.queryParameters.colorProfile === 'projector' );
new BooleanProperty( phet.chipper.queryParameters.colorProfile === 'projector', {
tandem: options.tandem.createTandem( 'projectorModeEnabledProperty' )
} );

const label = new Text( projectorModeString, {
font: options.font,
Expand Down

0 comments on commit ba1c1aa

Please sign in to comment.