Skip to content

Commit

Permalink
Cleanup in FaradaysLawModel, see #86
Browse files Browse the repository at this point in the history
  • Loading branch information
samreid committed Nov 5, 2017
1 parent c2041dc commit 9f860cf
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions js/faradays-law/model/FaradaysLawModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ define( function( require ) {
this.voltmeterModel = new Voltmeter( this, tandem.createTandem( 'voltmeterModel' ) );

//if show second coil and magnet over it, reset magnet
this.showTopCoilProperty.link( function( show ) {
if ( show && self.intersectionWithSecondCoil() ) {
this.showTopCoilProperty.link( function( showTopCoil ) {
if ( showTopCoil && self.intersectionWithTopCoil() ) {
self.magnetModel.positionProperty.reset();
}
self.intersectedBounds = null;
Expand Down Expand Up @@ -114,8 +114,9 @@ define( function( require ) {
/**
* returns true if magnet intersects coil bounds
* @returns {boolean}
* @private
*/
intersectionWithSecondCoil: function() {
intersectionWithTopCoil: function() {
var magnetBounds = Bounds2.point( this.magnetModel.positionProperty.get() ).dilatedXY( this.magnetModel.width / 2, this.magnetModel.height / 2 );
return magnetBounds.intersectsBounds( this.restricted[ 1 ] ) || magnetBounds.intersectsBounds( this.restricted[ 0 ] );
},
Expand Down

0 comments on commit 9f860cf

Please sign in to comment.