Skip to content

Commit

Permalink
change the order of things in model.reset and model.startOver
Browse files Browse the repository at this point in the history
  • Loading branch information
pixelzoom committed Aug 27, 2020
1 parent 0ea3078 commit cebb401
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions js/common/model/NaturalSelectionModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -245,12 +245,12 @@ class NaturalSelectionModel {
*/
reset() {

this.startOver();

// These Properties are not reset by startOver
this.timeSpeedProperty.reset();

// environmental factors
this.environmentProperty.reset();

// Everything else is the same as startOver
this.startOver();
}

/**
Expand All @@ -261,7 +261,6 @@ class NaturalSelectionModel {

phet.log && phet.log( '====== Generation 0 ======' );

this.simulationModeProperty.reset();
this.isPlayingProperty.reset(); // see https://github.com/phetsims/natural-selection/issues/55
this.generationClock.reset();

Expand All @@ -277,6 +276,9 @@ class NaturalSelectionModel {
this.populationModel.reset();
this.proportionsModel.reset();
this.pedigreeModel.reset();

// Reset the mode last, because listeners may inspect other model state.
this.simulationModeProperty.reset();
}

/**
Expand Down

1 comment on commit cebb401

@pixelzoom
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.