Skip to content

Commit

Permalink
Reset launcher Properties, see #288
Browse files Browse the repository at this point in the history
  • Loading branch information
samreid committed Apr 12, 2024
1 parent 1b9a676 commit 9a0266a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
6 changes: 6 additions & 0 deletions js/common/model/Launcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ export default class Launcher extends PhetioObject {
tandem: Tandem.OPT_OUT
}
} );

this.standardDeviationAngleProperty = new DerivedProperty( [ this.angleStabilityProperty ], angleStability => {
return Utils.roundToInterval( Utils.linear( 1, 0, PDLConstants.ANGLE_STANDARD_DEVIATION_RANGE.min, PDLConstants.ANGLE_STANDARD_DEVIATION_RANGE.max, angleStability ), 1e-6 );
}, {
Expand All @@ -94,6 +95,11 @@ export default class Launcher extends PhetioObject {
derive: launcherMechanism => launcherMechanism.speedStandardDeviationProperty
} );
}

public reset(): void {
this.launcherMechanismProperty.reset();
this.angleStabilityProperty.reset();
}
}

const mysteryLaunchersTandem = Tandem.GLOBAL_MODEL.createTandem( 'mysteryLaunchers' );
Expand Down
3 changes: 3 additions & 0 deletions js/measures/model/MeasuresField.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,9 @@ export default class MeasuresField extends SMField {
public override reset(): void {
super.reset();

//Reset all launchers
this.launchers.forEach( launcher => launcher.reset() );

this.mysteryOrCustomProperty.reset();
this.mysteryLauncherProperty.reset();
}
Expand Down

0 comments on commit 9a0266a

Please sign in to comment.