Skip to content

Commit

Permalink
Added JSDoc and inlined children, see #86
Browse files Browse the repository at this point in the history
  • Loading branch information
samreid committed Nov 21, 2017
1 parent 5f94cd5 commit b6ed96b
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 24 deletions.
4 changes: 3 additions & 1 deletion js/faradays-law/view/FaradaysLawScreenView.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,13 @@ define( function( require ) {
y: model.topCoil.position.y
} );

// @public {Vector2[]}
this.bottomCoilEndPositions = {
topEnd: bottomCoilNode.endRelativePositions.topEnd.plus( model.bottomCoil.position ),
bottomEnd: bottomCoilNode.endRelativePositions.bottomEnd.plus( model.bottomCoil.position )
};

// @public {Vector2[]}
this.topCoilEndPositions = {
topEnd: topCoilNode.endRelativePositions.topEnd.plus( model.topCoil.position ),
bottomEnd: topCoilNode.endRelativePositions.bottomEnd.plus( model.topCoil.position )
Expand Down Expand Up @@ -81,7 +83,7 @@ define( function( require ) {
voltmeterNode.center = FaradaysLawConstants.VOLTMETER_POSITION;
this.addChild( voltmeterNode );

// magnet
// @private
this.magnetNodeWithField = new MagnetNodeWithField( model, tandem.createTandem( 'magnet' ) );
this.addChild( this.magnetNodeWithField );

Expand Down
5 changes: 5 additions & 0 deletions js/faradays-law/view/MagnetAccessibleDragHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,13 @@ define( function( require ) {
function MagnetAccessibleDragHandler( positionProperty, startDrag, onDrag ) {
var self = this;

// @private
this.onDrag = onDrag;

// @private
this.positionProperty = positionProperty;

// @private
this.speedState = { direction: null, speedIndex: -1 };

var stopMotion = function() {
Expand Down
2 changes: 1 addition & 1 deletion js/faradays-law/view/MagnetNodeWithField.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ define( function( require ) {
} );
draggableNode.addInputListener( dragHandler );

// The sticky drag handler for keyboard navigation
// @private - The sticky drag handler for keyboard navigation
this.magnetAccessibleDragHandler = new MagnetAccessibleDragHandler( model.magnet.positionProperty, function() {
model.showMagnetArrowsProperty.set( false );
},
Expand Down
52 changes: 30 additions & 22 deletions js/faradays-law/view/VoltmeterNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,31 +89,39 @@ define( function( require ) {
this.addChild( label );

// add the plus and minus terminals at the bottom
this.plusNode = new Node();
this.plusNode.addChild( new Rectangle( -TERMINAL_SIZE / 2, -TERMINAL_SIZE / 2, TERMINAL_SIZE, TERMINAL_SIZE, TERMINAL_BORDER_RADIUS, TERMINAL_BORDER_RADIUS, {
fill: TERMINAL_COLOR,
stroke: TERMINAL_STROKE
} ) );
this.plusNode.addChild( new PlusNode( {
centerX: 0,
centerY: 0,
size: TERMINAL_SIGN_SIZE
} ) );
// @public
this.plusNode = new Node( {
children: [
new Rectangle( -TERMINAL_SIZE / 2, -TERMINAL_SIZE / 2, TERMINAL_SIZE, TERMINAL_SIZE, TERMINAL_BORDER_RADIUS, TERMINAL_BORDER_RADIUS, {
fill: TERMINAL_COLOR,
stroke: TERMINAL_STROKE
} ),
new PlusNode( {
centerX: 0,
centerY: 0,
size: TERMINAL_SIGN_SIZE
} )
],
center: new Vector2( TERMINAL_SIZE, RECTANGLE_HEIGHT / 2 + TERMINAL_SIZE / 2 )
} );
this.addChild( this.plusNode );
this.plusNode.center = new Vector2( TERMINAL_SIZE, RECTANGLE_HEIGHT / 2 + TERMINAL_SIZE / 2 );

this.minusNode = new Node();
this.minusNode.addChild( new Rectangle( -TERMINAL_SIZE / 2, -TERMINAL_SIZE / 2, TERMINAL_SIZE, TERMINAL_SIZE, TERMINAL_BORDER_RADIUS, TERMINAL_BORDER_RADIUS, {
fill: TERMINAL_COLOR,
stroke: TERMINAL_STROKE
} ) );
this.minusNode.addChild( new MinusNode( {
centerX: 0,
centerY: 0,
size: TERMINAL_SIGN_SIZE
} ) );
// @public
this.minusNode = new Node( {
children: [
new Rectangle( -TERMINAL_SIZE / 2, -TERMINAL_SIZE / 2, TERMINAL_SIZE, TERMINAL_SIZE, TERMINAL_BORDER_RADIUS, TERMINAL_BORDER_RADIUS, {
fill: TERMINAL_COLOR,
stroke: TERMINAL_STROKE
} ),
new MinusNode( {
centerX: 0,
centerY: 0,
size: TERMINAL_SIGN_SIZE
} )
],
center: new Vector2( -TERMINAL_SIZE, RECTANGLE_HEIGHT / 2 + TERMINAL_SIZE / 2 )
} );
this.addChild( this.minusNode );
this.minusNode.center = new Vector2( -TERMINAL_SIZE, RECTANGLE_HEIGHT / 2 + TERMINAL_SIZE / 2 );
}

faradaysLaw.register( 'VoltmeterNode', VoltmeterNode );
Expand Down

0 comments on commit b6ed96b

Please sign in to comment.