const isResettingProperty = new BooleanProperty( false );
export default isResettingProperty;
CAVScreenView.ts:
this.resetAllButton = new ResetAllButton( {
listener: () => {
assert && assert( !isResettingProperty.value, 'cannot reset while already resetting' );
isResettingProperty.value = true;
this.interruptSubtreeInput(); // cancel interactions that may be in progress
model.reset();
isResettingProperty.value = false;
},
VariabilityScreenView.ts:
export default class VariabilityScreenView extends CAVScreenView {
...
public constructor( model: VariabilityModel, providedOptions: VariabilityScreenViewOptions ) {
...
this.intervalToolNode = new IntervalToolNode( model.intervalToolModel, model.variabilityModelResetInProgressProperty,
VariabilityModel.ts:
// Whether the variability model is currently in the process of resetting. Used to handle intermediate states.
public readonly variabilityModelResetInProgressProperty = new BooleanProperty( false );
public override reset(): void {
this.variabilityModelResetInProgressProperty.value = true;
...
this.variabilityModelResetInProgressProperty.value = false;
}
I ran into this while looking for "sound" exemplars for FEL.
Why is VariabilityModel
variabilityModelResetInProgressProperty
needed? Is seems redundant, given that you have globalisResettingProperty
. It looks like it was added by @samreid for https://github.com/phetsims/center-and-variability/issues/236 (sounds) in https://github.com/phetsims/center-and-variability/commit/c7bcb7e85bb90ecb032a7bccfda89502366b9f86. Recommended to replace it withisResettingProperty
.Relevant code...
isResettingProperty.ts:
CAVScreenView.ts:
VariabilityScreenView.ts:
VariabilityModel.ts: