From 50bb056e1fd4a253ba94d0297cfe9c34ac771f6a Mon Sep 17 00:00:00 2001 From: Michael Kauzmann Date: Tue, 14 May 2024 17:05:02 -0600 Subject: [PATCH] reset the expandedProperty, https://github.com/phetsims/buoyancy/issues/150 Signed-off-by: Michael Kauzmann --- js/buoyancy/view/BuoyancyLabScreenView.ts | 2 ++ js/common/view/DensityBuoyancyScreenView.ts | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/js/buoyancy/view/BuoyancyLabScreenView.ts b/js/buoyancy/view/BuoyancyLabScreenView.ts index e5261008..485c7339 100644 --- a/js/buoyancy/view/BuoyancyLabScreenView.ts +++ b/js/buoyancy/view/BuoyancyLabScreenView.ts @@ -81,6 +81,8 @@ export default class BuoyancyLabScreenView extends DensityBuoyancyScreenView fluidDisplacedAccordionBox.expandedProperty.reset() ); + const leftSideVBox = new VBox( { align: 'left', spacing: 5, diff --git a/js/common/view/DensityBuoyancyScreenView.ts b/js/common/view/DensityBuoyancyScreenView.ts index 490cceef..7dfb43f9 100644 --- a/js/common/view/DensityBuoyancyScreenView.ts +++ b/js/common/view/DensityBuoyancyScreenView.ts @@ -65,6 +65,7 @@ import DuckView from '../../buoyancy/view/DuckView.js'; import NumberIO from '../../../../tandem/js/types/NumberIO.js'; import Utils from '../../../../dot/js/Utils.js'; import createObservableArray, { ObservableArray } from '../../../../axon/js/createObservableArray.js'; +import Emitter from '../../../../axon/js/Emitter.js'; // constants const MARGIN = DensityBuoyancyCommonConstants.MARGIN; @@ -114,6 +115,9 @@ export default class DensityBuoyancyScreenView; + // Called upon resetting + protected readonly resetEmitter = new Emitter(); + public constructor( model: Model, providedOptions: SelfOptions ) { const scaleIncrease = 3.5; @@ -574,6 +578,7 @@ export default class DensityBuoyancyScreenView { this.interruptSubtreeInput(); model.reset(); + this.resetEmitter.emit(); }, tandem: tandem.createTandem( 'resetAllButton' ) } );