Skip to content

Commit

Permalink
Use scenery/js/util/createGatedVisibleProperty, see phetsims/projecti…
Browse files Browse the repository at this point in the history
  • Loading branch information
samreid committed Feb 23, 2024
1 parent 46bd36f commit bf1776b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions js/imports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ export { default as PaintDef } from './util/PaintDef.js';
export type { default as TColor } from './util/TColor.js';
export type { default as TPaint } from './util/TPaint.js';

export { default as createGatedVisibleProperty } from './util/createGatedVisibleProperty.js';

// Filters
export { default as ColorMatrixFilter } from './filters/ColorMatrixFilter.js';
export { default as Brightness } from './filters/Brightness.js';
Expand Down
4 changes: 3 additions & 1 deletion js/util/createGatedVisibleProperty.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { PhetioObjectOptions } from '../../../tandem/js/PhetioObject.js';
import { combineOptions } from '../../../phet-core/js/optionize.js';
import { scenery } from '../imports.js';

export const createGatedVisibleProperty = ( visibleProperty: TReadOnlyProperty<boolean>, tandem: Tandem, selfVisiblePropertyOptions?: PhetioObjectOptions ): TReadOnlyProperty<boolean> => {
const createGatedVisibleProperty = ( visibleProperty: TReadOnlyProperty<boolean>, tandem: Tandem, selfVisiblePropertyOptions?: PhetioObjectOptions ): TReadOnlyProperty<boolean> => {
return DerivedProperty.and( [ visibleProperty, new BooleanProperty( true, combineOptions<PhetioObjectOptions>( {
tandem: tandem.createTandem( 'selfVisibleProperty' ),
phetioFeatured: true
Expand All @@ -29,4 +29,6 @@ export const createGatedVisibleProperty = ( visibleProperty: TReadOnlyProperty<b
} );
};

export default createGatedVisibleProperty;

scenery.register( 'createGatedVisibleProperty', createGatedVisibleProperty );

0 comments on commit bf1776b

Please sign in to comment.