Skip to content

Commit

Permalink
Cleanup in MagnifierNode, see #64
Browse files Browse the repository at this point in the history
  • Loading branch information
samreid committed Feb 14, 2018
1 parent 260173e commit 25e8915
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions js/friction/view/magnifier/MagnifierNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -288,8 +288,9 @@ define( function( require ) {
},

/**
* TODO: documentation
* Add the layers of atoms to the view *and* to the model.
* @param {FrictionModel} model
* @private
*/
addAtoms: function( model ) {
var self = this;
Expand All @@ -299,16 +300,16 @@ define( function( require ) {
var dy = model.atoms.distanceY;

/**
* TODO: docs and types
* @param target
* @param layer
* @param y TODO: why does y go before x?
* @param x
* @param {Node} target
* @param {Object[]} layer
* @param {number} x - origin in x coordinate
* @param {number} y - origin in y coordinate
* @param {string} color - this must be a string because it indexes into an object.
*/
var addLayer = function( target, layer, y, x, color ) {
var addLayer = function( target, layer, x, y, color ) {

assert && assert( typeof color === 'string', 'Color should be a string' );

// TODO: assert that color is a string
var evaporate;
var row = [];

Expand All @@ -330,12 +331,12 @@ define( function( require ) {

// add top atoms
topAtoms.atoms.layers.forEach( function( layer, i ) {
addLayer( topAtoms.target, layer, topAtoms.y + dy * i, topAtoms.x, topAtoms.atoms.color );
addLayer( topAtoms.target, layer, topAtoms.x, topAtoms.y + dy * i, topAtoms.atoms.color );
} );

// add bottom atoms
bottomAtoms.atoms.layers.forEach( function( layer, i ) {
addLayer( bottomAtoms.target, layer, self.bottomAtoms.y + dy * i, self.bottomAtoms.x, bottomAtoms.atoms.color );
addLayer( bottomAtoms.target, layer, self.bottomAtoms.x, self.bottomAtoms.y + dy * i, bottomAtoms.atoms.color );
} );
},

Expand All @@ -345,10 +346,9 @@ define( function( require ) {
* @param {Node} target
* @param {Node} target
* @param {Object} [options]
* TODO: visibility annotation
* @private
*/
addRowCircles: function( model, target, options ) {

var numberOfAtomsForRow = options.width / model.atoms.distanceX;
for ( var i = 0; i < numberOfAtomsForRow; i++ ) {
target.addChild( new Circle( model.atoms.radius, {
Expand All @@ -359,4 +359,4 @@ define( function( require ) {
}
}
} );
} );
} );

0 comments on commit 25e8915

Please sign in to comment.