Skip to content

Commit

Permalink
Addressed REVIEW: Corrections after refactoring model.options.basicsV…
Browse files Browse the repository at this point in the history
…ersion. Also corrected shelves not appearing on desired screens. phetsims/masses-and-springs-basics#48
  • Loading branch information
Denz1994 committed Jan 30, 2019
1 parent f334342 commit 7f2c2e1
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion js/common/model/MassesAndSpringsModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ define( function( require ) {
function MassesAndSpringsModel( tandem ) {

// Flag used to differentiate basics and non-basics version
this.basicsVersion = false;
this.basicsVersion = true;

// @public {Enumeration}
this.forcesModeChoice = new Enumeration( [ 'FORCES', 'NET_FORCES' ] );
Expand Down
1 change: 1 addition & 0 deletions js/energy/model/EnergyModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ define( function( require ) {
*/
function EnergyModel( tandem ) {
MassesAndSpringsModel.call( this, tandem );
this.basicsVersion = false;

// Energy screen should have spring damping
// REVIEW: This looks like we should pass in the initial value of damping, instead of overwriting the Property.
Expand Down
1 change: 1 addition & 0 deletions js/energy/view/EnergyScreenView.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ define( function( require ) {
this.addChild( rightPanelsVBox );
rightPanelsVBox.moveToBack();


this.visibleBoundsProperty.link( function() {
rightPanelsVBox.rightTop = new Vector2( self.panelRightSpacing, self.energyGraphNode.top );
} );
Expand Down
1 change: 1 addition & 0 deletions js/intro/model/IntroModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ define( function( require ) {

MassesAndSpringsModel.call( this, tandem );
var self = this;
this.basicsVersion = false;

// @public {Enumeration} Choices for constant parameter
this.constantModeChoice = new Enumeration( [ 'SPRING_CONSTANT', 'SPRING_THICKNESS' ] );
Expand Down
2 changes: 1 addition & 1 deletion js/lab/LabScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ define( function( require ) {

Screen.call( this,
function() {
return new LabModel( tandem.createTandem( 'model' ) );
return new LabModel( tandem.createTandem( 'model' ), false );
},
function( model ) {
return new LabScreenView( model, tandem.createTandem( 'view' ) );
Expand Down
4 changes: 3 additions & 1 deletion js/lab/model/LabModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,16 @@ define( function( require ) {
var MASS_OFFSET = 0.15;

/**
* @param {Boolean} basicsVersion
* @param {Tandem} tandem
* @param {object} options
*
* @constructor
*/
function LabModel( tandem, options ) {
function LabModel( tandem, basicsVersion, options ) {

MassesAndSpringsModel.call( this, tandem, options );
this.basicsVersion = basicsVersion;

// Lab screen shouldn't have spring damping for non-basics version
this.dampingProperty = new NumberProperty( this.basicsVersion ? 0 : 0.0575 );
Expand Down
1 change: 1 addition & 0 deletions js/vectors/VectorsScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ define( function( require ) {
function() {
var modelTandem = tandem.createTandem( 'model' );
var model = new MassesAndSpringsModel( modelTandem );
model.basicsVersion = false;
model.addDefaultSprings( modelTandem );
model.addDefaultMasses( modelTandem );
return model;
Expand Down

0 comments on commit 7f2c2e1

Please sign in to comment.