Closed pixelzoom closed 1 year ago
Discovered while adding missing readonly keywords in https://github.com/phetsims/my-solar-system/issues/214 ...
readonly
In SolarSystemCommonModel, defaultBodyState should be readonly, and it's assigned once in the constructor:
defaultBodyState
protected defaultBodyState: BodyInfo[]; ... this.defaultBodyState = this.availableBodies.map( body => body.info );
class KeplersLawsModel extends SolarSystemCommonModel, and overwrites defaultBodyState:
this.defaultBodyState = [ { active: true, mass: 200, position: new Vector2( 0, 0 ), velocity: new Vector2( 0, 0 ) }, { active: true, mass: 50, position: new Vector2( 200, 0 ), velocity: new Vector2( 0, 81.6 ) } ];
defaultBodyState should be added as an option to SolarSystemCommonModelOptions.
Made the above changes to correct this, let me know if they seem like the right approach.
Looks good, and defaultBodyState is now readonly. Closing.
Discovered while adding missing
readonly
keywords in https://github.com/phetsims/my-solar-system/issues/214 ...In SolarSystemCommonModel,
defaultBodyState
should be readonly, and it's assigned once in the constructor:class KeplersLawsModel extends SolarSystemCommonModel, and overwrites
defaultBodyState
:defaultBodyState
should be added as an option to SolarSystemCommonModelOptions.