Skip to content

Commit

Permalink
final review items, comment & documentation updates. see #19
Browse files Browse the repository at this point in the history
  • Loading branch information
mbarlow12 committed Nov 29, 2017
1 parent 7caf4e3 commit f7f6937
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 16 deletions.
3 changes: 0 additions & 3 deletions js/ISLCConstants.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ define( function( require ) {
var MIN_MASS = 1; // kg
var MAX_MASS = 1000; // kg

// TODO: This is sim and screen specific, should not be a constant in INverseSquareLawConstants
// TODO: Consider caluclating this instead of choosing random values - might be tough when
// radii can grow.
var MAX_DISTANCE_FROM_CENTER = 5; // meters, empirically determined boundary for objects

var ISLCConstants = {
Expand Down
2 changes: 1 addition & 1 deletion js/model/ISLCModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ define( function( require ) {
return inherit( Object, ISLCModel, {

/**
* step function makes sure masses doesn't goes out of bounds and don't overlap each other at each time step
* Step function makes sure masses doesn't goes out of bounds and don't overlap each other at each time step
* @public
*/
step: function() {
Expand Down
2 changes: 1 addition & 1 deletion js/model/ISLCObject.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ define( function( require ) {
leftObjectBoundary: ISLCConstants.LEFT_OBJECT_BOUNDARY,
rightObjectBoundary: ISLCConstants.RIGHT_OBJECT_BOUNDARY,

tandem: Tandem.required, // tandem optional until sim is instrumented - TODO: come back to this
tandem: Tandem.required,
tandemUnits: 'kilograms',
}, options );

Expand Down
5 changes: 3 additions & 2 deletions js/view/ISLCLegendNode.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
// Copyright 2017, University of Colorado Boulder

/**
* A legend graphic consisting of a double-ended arrow, two endpoint lines, and a label string. Intended to visually indicate a distance scale.
* A legend graphic consisting of a double-ended arrow, two endpoint lines, and a label string. Intended to visually
* indicate a distance scale.
*
* @author Michael Barlow
*/
Expand All @@ -16,11 +17,11 @@ define( function( require ) {
var Text = require( 'SCENERY/nodes/Text' );

/**
* @constructor
* @param {ISLModel} model
* @param {ModelViewTransform2} modelViewTransform
* @param {int/float} width (in view coordinates)
* @param {string} labelString
* @constructor
*/
function ISLCLegendNode( width, labelString, options ) {

Expand Down
20 changes: 13 additions & 7 deletions js/view/ISLCObjectNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ define( function( require ) {

/**
*
* @constructor
* @param {ISLModel} model
* @param {ISLObjectModel} objectModel
* @param {ISLModel} model - the simulation model
* @param {ISLObjectModel} objectModel - the associated object's model within the sim
* @param {Bounds2} layoutBounds - bounds of the screen view containing the object
* @param {ModelViewTransform2} modelViewTransform
* @param {Range} pullForceRange - the max and min possible force values
* @param {Tandem} tandem
* @param {Object} options
* @constructor
*/
function ISLCObjectNode( model, objectModel, layoutBounds, modelViewTransform, pullForceRange, tandem, options ) {

Expand Down Expand Up @@ -85,6 +85,7 @@ define( function( require ) {
tandem: tandem
} );

// @protected
this.layoutBounds = layoutBounds;
this.objectModel = objectModel;
this.model = model;
Expand Down Expand Up @@ -129,9 +130,6 @@ define( function( require ) {
// set y position for the arrow
this.arrowNode.y = options.y - options.forceArrowHeight;

// @private - the puller node
// options: ropeLength, shadowMinWidth, shadowMaxWidth, attractNegative, displayShadow
// we may only need to pass attractNegative & ropeLength
var pullerOptionKeys = [
'ropeLength',
'shadowMinWidth',
Expand All @@ -140,6 +138,7 @@ define( function( require ) {
'displayShadow'
];

// @private - the puller node
this.pullerNode = new ISLCPullerNode(
pullForceRange,
tandem.createTandem( 'pullerNode' ),
Expand All @@ -158,12 +157,14 @@ define( function( require ) {

// the 'object' - a shaded circle
var radius = modelViewTransform.modelToViewDeltaX( objectModel.radiusProperty.get() );

// @protected - the object
this.objectCircle = new Circle( radius );

dragNode.addChild( this.pullerNode );
dragNode.addChild( this.objectCircle );

// TODO: What is this circle doing here?
// Small black dot where vertical arrow line connects to the object
dragNode.addChild( new Circle( 2, { fill: '#000' } ) );

var labelCenterX = 0;
Expand Down Expand Up @@ -192,6 +193,8 @@ define( function( require ) {
} ) );

this.addChild( dragNode );

// @private
this.y = options.y;

// the marker line, connecting the arrow to the object, the first one is for the shadow so that
Expand Down Expand Up @@ -284,6 +287,9 @@ define( function( require ) {

inherit( Node, ISLCObjectNode, {

/**
* Redraws the white radial gradient for the object - must be implemented in subtypes.
*/
updateGradient: function() {
throw new Error( 'Update gradient must be implemented in subtypes.' );
},
Expand Down
3 changes: 1 addition & 2 deletions js/view/ISLCPullerNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ define( function( require ) {
*/
function ISLCPullerNode( forceRange, tandem, options ) {

// REVIEW: This node doesn't pass options to Node
options = _.extend( {
ropeLength: 50,
shadowMinWidth: 32,
Expand Down Expand Up @@ -157,7 +156,7 @@ define( function( require ) {
tandem: tandem.createTandem( 'shadowNode' )
} );

// create the puller/pusher image nodes
// create each of the puller/pusher image nodes
var images = [];
var i;
for ( i = 0; i < this.pullerPusherImages.length; i++ ) {
Expand Down

0 comments on commit f7f6937

Please sign in to comment.