Skip to content

Commit

Permalink
Addressed REVIEW: Refactor SimSpeedChoice enum phetsims/masses-and-sp…
Browse files Browse the repository at this point in the history
  • Loading branch information
Denz1994 committed Jan 30, 2019
1 parent 346e2e8 commit 033a19a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions js/common/model/MassesAndSpringsModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ define( function( require ) {
var Property = require( 'AXON/Property' );
var PropertyIO = require( 'AXON/PropertyIO' );
var Range = require( 'DOT/Range' );
var SimSpeedChoice = require( 'MASSES_AND_SPRINGS/common/enum/SimSpeedChoice' );
var Spring = require( 'MASSES_AND_SPRINGS/common/model/Spring' );
var StringIO = require( 'TANDEM/types/StringIO' );
var Vector2 = require( 'DOT/Vector2' );
Expand All @@ -47,6 +46,7 @@ define( function( require ) {

// @public {Enumeration}
this.forcesModeChoice = new Enumeration( [ 'FORCES', 'NET_FORCES' ] );
this.simSpeedChoice = new Enumeration( [ 'NORMAL', 'SLOW' ] );

// @public {Property.<boolean>} determines whether the sim is in a play/pause state
this.playingProperty = new BooleanProperty( true, {
Expand All @@ -67,10 +67,10 @@ define( function( require ) {
} );

// @public {Property.<string>} determines the speed at which the sim plays.
this.simSpeedProperty = new Property( SimSpeedChoice.NORMAL, {
this.simSpeedProperty = new Property( this.simSpeedChoice.NORMAL, {
tandem: tandem.createTandem( 'simSpeedProperty' ),
phetioType: PropertyIO( StringIO ),
validValues: [ SimSpeedChoice.SLOW, SimSpeedChoice.NORMAL ]
validValues: [ this.simSpeedChoice.SLOW, this.simSpeedChoice.NORMAL ]
} );

// @public {Property.<boolean>} determines visibility of ruler node
Expand Down Expand Up @@ -373,7 +373,7 @@ define( function( require ) {
var animationDt = dt;

// Change the dt value if we are playing in slow motion.
if ( this.simSpeedProperty.get() === SimSpeedChoice.SLOW && this.playingProperty.get() ) {
if ( this.simSpeedProperty.get() === this.simSpeedChoice.SLOW && this.playingProperty.get() ) {
dt = dt / MassesAndSpringsConstants.SLOW_SIM_DT_RATIO;
}
for ( var i = 0; i < this.masses.length; i++ ) {
Expand Down
4 changes: 2 additions & 2 deletions js/common/view/SpringScreenView.js
Original file line number Diff line number Diff line change
Expand Up @@ -232,10 +232,10 @@ define( function( require ) {
model.playingProperty,
new DynamicProperty( new Property( model.simSpeedProperty ), {
map: function( simSpeed ) {
return simSpeed === SimSpeedChoice.SLOW;
return simSpeed === model.simSpeedChoice.SLOW;
},
inverseMap: function( isSlow ) {
return isSlow ? SimSpeedChoice.SLOW : SimSpeedChoice.NORMAL;
return isSlow ? model.simSpeedChoice.SLOW : model.simSpeedChoice.NORMAL;
},
bidirectional: true
} ), {
Expand Down

0 comments on commit 033a19a

Please sign in to comment.