Skip to content

Commit

Permalink
Cleanup in Magnet, see #86
Browse files Browse the repository at this point in the history
  • Loading branch information
samreid committed Nov 5, 2017
1 parent bb5ed27 commit 1015677
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 16 deletions.
2 changes: 1 addition & 1 deletion js/faradays-law/model/FaradaysLawModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ define( function( require ) {
this.magnetMovingDirection = null; // TODO: should be enum

// @public - the Voltmeter
this.voltmeter = new Voltmeter( this, tandem.createTandem( 'voltmeterModel' ) );
this.voltmeter = new Voltmeter( this, tandem.createTandem( 'voltmeter' ) );

// If the magnet intersects the top coil area when the top coil is shown, then reset the magnet.
this.showTopCoilProperty.link( function( showTopCoil ) {
Expand Down
26 changes: 15 additions & 11 deletions js/faradays-law/model/Magnet.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,13 @@ define( function( require ) {
'use strict';

// modules
var BooleanProperty = require( 'AXON/BooleanProperty' );
var faradaysLaw = require( 'FARADAYS_LAW/faradaysLaw' );
var inherit = require( 'PHET_CORE/inherit' );
var Property = require( 'AXON/Property' );
var TVector2 = require( 'DOT/TVector2' );
var Vector2 = require( 'DOT/Vector2' );

// phet-io modules
var TBoolean = require( 'ifphetio!PHET_IO/types/TBoolean' );

/**
* @param {number} x - x position of magnet
* @param {number} y - y position of magnet
Expand All @@ -29,31 +27,37 @@ define( function( require ) {
*/
function Magnet( x, y, width, height, tandem ) {

// @public {number} - width of the magnet
this.width = width;

// @public {number} - height of the magnet
this.height = height;

// @public {Property.<Vector2>} - position of the magnet
this.positionProperty = new Property( new Vector2( x, y ), {
tandem: tandem.createTandem( 'positionProperty' ),
phetioValueType: TVector2
} );

// is the magnet flipped?
this.flippedProperty = new Property( false, {
tandem: tandem.createTandem( 'flippedProperty' ),
phetioValueType: TBoolean
// @public {BooleanProperty} - true if the magnet is flipped
this.flippedProperty = new BooleanProperty( false, {
tandem: tandem.createTandem( 'flippedProperty' )
} );

// show field lines for magnet
this.showFieldLinesProperty = new Property( false, {
tandem: tandem.createTandem( 'showFieldLinesProperty' ),
phetioValueType: TBoolean
// @public {BooleanProperty} - show field lines for magnet
this.showFieldLinesProperty = new BooleanProperty( false, {
tandem: tandem.createTandem( 'showFieldLinesProperty' )
} );
}

faradaysLaw.register( 'Magnet', Magnet );

return inherit( Object, Magnet, {

/**
* Restore the initial conditions
* @public
*/
reset: function() {
this.positionProperty.reset();
this.flippedProperty.reset();
Expand Down
2 changes: 1 addition & 1 deletion js/faradays-law/view/Aligner.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ define( function( require ) {

/**
*
* @param {FaradayslawModel} model
* @param {FaradaysLawModel} model
* @param {Object} bottomCoilEndRelativePositions
* @param {Object} topCoilEndRelativePositions
* @constructor
Expand Down
2 changes: 1 addition & 1 deletion js/faradays-law/view/FaradaysLawScreenView.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ define( function( require ) {
var VoltmeterWiresNode = require( 'FARADAYS_LAW/faradays-law/view/VoltmeterWiresNode' );

/**
* @param {gameModel} model - Faraday's Law simulation model object
* @param {FaradaysLawModel} model - Faraday's Law simulation model object
* @param {Tandem} tandem
* @constructor
*/
Expand Down
1 change: 0 additions & 1 deletion js/faradays-law/view/MagnetFieldLines.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ define( function( require ) {
this.addChild( bottomLines );

magnet.showFieldLinesProperty.linkAttribute( this, 'visible' );

}

faradaysLaw.register( 'MagnetFieldLines', MagnetFieldLines );
Expand Down
1 change: 0 additions & 1 deletion js/faradays-law/view/MagnetNodeWithField.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ define( function( require ) {
};

/**
*
* @param {FaradaysLawModel} model - 'Faradays Law' simulation model
* @param {Tandem} tandem - this node is not instrumented but the input listener is
* @constructor
Expand Down

0 comments on commit 1015677

Please sign in to comment.