From cf1e8a9d1f65f504614467209a726767a63730f5 Mon Sep 17 00:00:00 2001 From: AgustinVallejo Date: Tue, 9 Jan 2024 21:04:54 -0500 Subject: [PATCH] Mass change workaround, see https://github.com/phetsims/my-solar-system/issues/328 and https://github.com/phetsims/scenery-phet/issues/825 (cherry picked from commit 18cc9b349467a7d6e1f1fe3164ae4381e07b078e) --- js/common/model/MySolarSystemModel.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/js/common/model/MySolarSystemModel.ts b/js/common/model/MySolarSystemModel.ts index d83ae94..8e5fe54 100644 --- a/js/common/model/MySolarSystemModel.ts +++ b/js/common/model/MySolarSystemModel.ts @@ -149,6 +149,14 @@ export default class MySolarSystemModel extends SolarSystemCommonModel { this.saveStartingBodyInfo(); } } ); + + body.massProperty.link( mass => { + // This workaround is because NumberControl endCallback fires before changing the property, at least on single presses + // TODO: Remove this workaround when https://github.com/phetsims/scenery-phet/issues/825 is fixed + if ( !body.userIsControllingMassProperty.value ) { + this.saveStartingBodyInfo(); + } + } ); } ); this.timeProperty.lazyLink( time => {