Skip to content

Commit

Permalink
implement reset functionality, see #54
Browse files Browse the repository at this point in the history
  • Loading branch information
jbphet committed Jan 3, 2025
1 parent cc8b5c3 commit b9a7bb2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
7 changes: 6 additions & 1 deletion js/bloch-sphere/model/BlochSphereModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,12 @@ export default class BlochSphereModel implements TModel {
* Resets the model.
*/
public reset(): void {
// no-op
this.preparationBlochSphere.reset();
this.selectedSceneProperty.reset();
this.readyToObserveProperty.reset();
this.magneticFieldStrengthProperty.reset();
this.measurementBasisProperty.reset();
this.isSingleMeasurementModeProperty.reset();
}

/**
Expand Down
6 changes: 5 additions & 1 deletion js/bloch-sphere/view/BlochSphereScreenView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,14 @@ import BlochSpherePreparationArea from './BlochSpherePreparationArea.js';

export default class BlochSphereScreenView extends QuantumMeasurementScreenView {

private readonly model: BlochSphereModel;

public constructor( model: BlochSphereModel, tandem: Tandem ) {

super( { tandem: tandem } );

this.model = model;

const preparationArea = new BlochSpherePreparationArea( model, this, {
left: this.layoutBounds.left + 20,
top: this.layoutBounds.top + 20,
Expand Down Expand Up @@ -68,10 +72,10 @@ export default class BlochSphereScreenView extends QuantumMeasurementScreenView
top: measurementAreaTitleAndComboBox.bottom + 20
} );
this.addChild( measurementArea );

}

public override reset(): void {
this.model.reset();
super.reset();
}
}
Expand Down

0 comments on commit b9a7bb2

Please sign in to comment.