From d8c1880827bfeaa2144665b031d52027dd4c8c9b Mon Sep 17 00:00:00 2001 From: Marla Schulz Date: Fri, 7 Jun 2024 10:43:37 -0700 Subject: [PATCH] Clean up tandems and phet-io, see: https://github.com/phetsims/mean-share-and-balance/issues/258 --- js/level-out/model/LevelOutModel.ts | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/js/level-out/model/LevelOutModel.ts b/js/level-out/model/LevelOutModel.ts index d173283..fe008c9 100644 --- a/js/level-out/model/LevelOutModel.ts +++ b/js/level-out/model/LevelOutModel.ts @@ -26,8 +26,10 @@ import VoidIO from '../../../../tandem/js/types/VoidIO.js'; import ArrayIO from '../../../../tandem/js/types/ArrayIO.js'; import optionize, { EmptySelfOptions } from '../../../../phet-core/js/optionize.js'; import TModel from '../../../../joist/js/TModel.js'; +import EnabledProperty from '../../../../axon/js/EnabledProperty.js'; +import WithRequired from '../../../../phet-core/js/types/WithRequired.js'; -type LevelOutModelOptions = EmptySelfOptions & PhetioObjectOptions; +type LevelOutModelOptions = EmptySelfOptions & WithRequired; // constants const INITIAL_WATER_LEVELS = [ 0.75, 0.5, 0.2, 0.65, 0.9, 0.35, 0.75 ]; @@ -109,19 +111,19 @@ export default class LevelOutModel extends PhetioObject implements TModel { tandem: options.tandem.createTandem( 'maxCupsProperty' ) } ); - this.pipesOpenProperty = new BooleanProperty( false, { - tandem: options.tandem.createTandem( 'pipesOpenProperty' ) - } ); - this.pipesEnabledProperty = new BooleanProperty( true, { - tandem: options.tandem.createTandem( 'pipesEnabledProperty' ) - } ); - // The tableCups are the "ground truth" and the notepadCups mirror them. this.tableCups = []; this.notepadCups = []; this.pipeArray = []; const pipesParentTandem = options.tandem.createTandem( 'pipes' ); + + this.pipesOpenProperty = new BooleanProperty( false, { + tandem: pipesParentTandem.createTandem( 'pipesOpenProperty' ) + } ); + this.pipesEnabledProperty = new EnabledProperty( true, { + tandem: pipesParentTandem.createTandem( EnabledProperty.TANDEM_NAME ) + } ); const notepadCupsParentTandem = options.tandem.createTandem( 'notepadCups' ); const tableCupsParentTandem = options.tandem.createTandem( 'tableCups' ); @@ -328,7 +330,7 @@ export default class LevelOutModel extends PhetioObject implements TModel { * For use by PhET-iO clients. Sets the waterLevelProperty of the table cups to the provided array * of numbers. If the array is longer than the number of table cups, the excess values are ignored. */ - private setDataPoints( dataPoints: number[] ): void { + public setDataPoints( dataPoints: number[] ): void { this.resetData(); this.numberOfCupsProperty.value = dataPoints.length; dataPoints.forEach( ( dataPoint, index ) => {