Skip to content

Commit

Permalink
Cleaned up vars, see #64
Browse files Browse the repository at this point in the history
  • Loading branch information
samreid committed Feb 13, 2018
1 parent daa1412 commit aab9c42
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
14 changes: 5 additions & 9 deletions js/friction/model/FrictionModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,12 +198,11 @@ define( function( require ) {
// @public (read-only) - show hint icon
this.hintProperty = new Property( true );

// @public (read-only)- update every step
// TODO: Use an emitter here
// @public - update every step
this.stepEmitter = new Emitter();

// @public (read-only) - drag and drop book coordinates conversion coefficient
this.dndScale = 0.025; // TODO: better name
this.bookDraggingScaleFactor = 0.025;

// check atom's contact
this.distanceProperty.link( function( distance ) {
Expand Down Expand Up @@ -272,7 +271,7 @@ define( function( require ) {
},

/**
* TODO: this must be called from the end of the view construction for unknown reasonrs, or atoms don't fly off
* TODO: this must be called from the end of the view construction for unknown reasons, or atoms don't fly off
* @public
*/
init: function() {
Expand All @@ -287,9 +286,6 @@ define( function( require ) {
}

this.atomRowsToEvaporateProperty.set( this.toEvaporate.length );

// set min vertical position
this.minYPos = MIN_Y_POSITION; // TODO: better name
},

/**
Expand All @@ -314,8 +310,8 @@ define( function( require ) {
this.bottomOffsetProperty.set( this.bottomOffsetProperty.get() + v.y - this.distanceProperty.get() );
v.y = this.distanceProperty.get();
}
else if ( this.bookPositionProperty.get().y + v.y < this.minYPos ) {
v.y = this.minYPos - this.bookPositionProperty.get().y; // Limit book from going out of magnifier window.
else if ( this.bookPositionProperty.get().y + v.y < MIN_Y_POSITION ) {
v.y = MIN_Y_POSITION - this.bookPositionProperty.get().y; // Limit book from going out of magnifier window.
}
if ( this.bookPositionProperty.get().x + v.x > MAX_X_DISPLACEMENT ) {
v.x = MAX_X_DISPLACEMENT - this.bookPositionProperty.get().x;
Expand Down
2 changes: 1 addition & 1 deletion js/friction/view/book/BookNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ define( function( require ) {

// add observer
model.bookPositionProperty.link( function( position ) {
self.setTranslation( options.x + position.x * model.dndScale, options.y + position.y * model.dndScale );
self.setTranslation( options.x + position.x * model.bookDraggingScaleFactor, options.y + position.y * model.bookDraggingScaleFactor );
} );
}
}
Expand Down

0 comments on commit aab9c42

Please sign in to comment.