diff --git a/js/faradays-law-main.js b/js/faradays-law-main.js index cb27e84e..0fdc7ca0 100644 --- a/js/faradays-law-main.js +++ b/js/faradays-law-main.js @@ -17,8 +17,6 @@ define( function( require ) { // strings var faradaysLawTitleString = require( 'string!FARADAYS_LAW/faradays-law.title' ); - var tandem = Tandem.rootTandem; - var simOptions = { credits: { leadDesign: 'Michael Dubson, Bryce Gruneich', @@ -32,7 +30,9 @@ define( function( require ) { // Create and start the sim SimLauncher.launch( function() { - var sim = new Sim( faradaysLawTitleString, [ new FaradaysLawScreen( tandem.createTandem( 'faradaysLawScreen' ) ) ], simOptions ); + var sim = new Sim( faradaysLawTitleString, [ + new FaradaysLawScreen( Tandem.rootTandem.createTandem( 'faradaysLawScreen' ) ) + ], simOptions ); sim.start(); } ); } ); \ No newline at end of file diff --git a/js/faradays-law/model/FaradaysLawModel.js b/js/faradays-law/model/FaradaysLawModel.js index 481199eb..33458b1e 100644 --- a/js/faradays-law/model/FaradaysLawModel.js +++ b/js/faradays-law/model/FaradaysLawModel.js @@ -133,12 +133,12 @@ define( function( require ) { // if first coil not visible, check only second coil restrictions for ( var i = this.showTopCoilProperty.get() ? 0 : 2; i < this.listOfRestrictedBounds.length; i++ ) { - var restricted = this.listOfRestrictedBounds[ i ]; - if ( magnetBounds.intersectsBounds( restricted ) ) { + var restrictedBounds = this.listOfRestrictedBounds[ i ]; + if ( magnetBounds.intersectsBounds( restrictedBounds ) ) { // extend area so magnet cannot jump through restricted area on other side of it if mouse far enough var movingDelta = position.minus( this.magnet.positionProperty.get() ); - this.intersectedBounds = restricted.copy(); + this.intersectedBounds = restrictedBounds.copy(); if ( Math.abs( movingDelta.y ) > Math.abs( movingDelta.x ) ) { // vertical direction diff --git a/js/faradays-law/view/BulbNode.js b/js/faradays-law/view/BulbNode.js index a43d046a..c3effd85 100644 --- a/js/faradays-law/view/BulbNode.js +++ b/js/faradays-law/view/BulbNode.js @@ -84,7 +84,7 @@ define( function( require ) { filamentShape.lineTo( filamentTopPoint.x + xZig, yPos ); } filamentShape.lineToPoint( filamentBottomPoint ); - var filament = new Path( filamentShape, { stroke: 'black' } ); + var filamentNode = new Path( filamentShape, { stroke: 'black' } ); // Create the 'halo' that makes the bulb look like it is shining. var haloNode = new Node( { @@ -118,7 +118,7 @@ define( function( require ) { this.children = [ bulbBodyFill, filamentSupportWires, - filament, + filamentNode, haloNode, bulbBase, bulbBodyOutline @@ -127,7 +127,7 @@ define( function( require ) { // Do some last layout bulbBase.centerY = 0; bulbBase.left = 0; - haloNode.center = filament.center; + haloNode.center = filamentNode.center; this.mutate( options ); diff --git a/js/faradays-law/view/MagnetFieldLines.js b/js/faradays-law/view/MagnetFieldLines.js index 4a055b62..9ddcb392 100644 --- a/js/faradays-law/view/MagnetFieldLines.js +++ b/js/faradays-law/view/MagnetFieldLines.js @@ -69,7 +69,7 @@ define( function( require ) { * @returns {Node} */ var createArcWithArrow = function( a, b, arrowPositions, flippedProperty, options ) { - var node = new Node(); + var arcWithArrow = new Node(); options = _.extend( { stroke: '#ffffff', lineWidth: 3 @@ -77,7 +77,7 @@ define( function( require ) { // arc var ellipticalShape = new Shape().ellipticalArc( 0, 0, a, b, 0, 0, 2 * Math.PI ); - node.addChild( new Path( ellipticalShape, { + arcWithArrow.addChild( new Path( ellipticalShape, { stroke: options.stroke, lineWidth: options.lineWidth } ) ); @@ -104,10 +104,10 @@ define( function( require ) { flippedProperty.lazyLink( function() { arrow.rotateAround( arrowPosition, Math.PI ); } ); - node.addChild( arrow ); + arcWithArrow.addChild( arrow ); } ); - return node; + return arcWithArrow; }; /** @@ -117,7 +117,7 @@ define( function( require ) { * @returns {Node} */ var createSideFieldLines = function( flippedProperty, scaleY ) { - var node = new Node(); + var sideFieldLinesContainer = new Node(); var dy = 3; @@ -126,10 +126,10 @@ define( function( require ) { var arc = createArcWithArrow( line.a, line.b, line.arrowPositions, flippedProperty ); arc.bottom = 2 - index * dy; arc.centerX = 0; - node.addChild( arc ); + sideFieldLinesContainer.addChild( arc ); } ); - node.scale( 1, scaleY ); - return node; + sideFieldLinesContainer.scale( 1, scaleY ); + return sideFieldLinesContainer; }; faradaysLaw.register( 'MagnetFieldLines', MagnetFieldLines ); diff --git a/js/faradays-law/view/MagnetNode.js b/js/faradays-law/view/MagnetNode.js index 64cc23dd..00723487 100644 --- a/js/faradays-law/view/MagnetNode.js +++ b/js/faradays-law/view/MagnetNode.js @@ -87,10 +87,10 @@ define( function( require ) { * @returns {Node} */ var drawHalfMagnetNode = function( magnetWidth, magnetHeight, label, backgroundColor, options ) { - var node = new Node(); + var halfMagnetNode = new Node(); // add the top and sides to create a 3D appearance - node.addChild( new Path( new Shape() + halfMagnetNode.addChild( new Path( new Shape() .moveTo( -magnetWidth / 4, -magnetHeight / 2 ) .lineTo( -magnetWidth / 4 + magnetWidth * MAGNET_OFFSET_DX_RATIO, -magnetHeight / 2 - magnetHeight * MAGNET_OFFSET_DY_RATIO ) .lineTo( magnetWidth / 4 + magnetWidth * MAGNET_OFFSET_DX_RATIO, -magnetHeight / 2 - magnetHeight * MAGNET_OFFSET_DY_RATIO ) @@ -102,7 +102,7 @@ define( function( require ) { } ) ); // add the front - node.addChild( new Rectangle( -magnetWidth / 4, -magnetHeight / 2, magnetWidth / 2, magnetHeight, { + halfMagnetNode.addChild( new Rectangle( -magnetWidth / 4, -magnetHeight / 2, magnetWidth / 2, magnetHeight, { fill: backgroundColor } ) ); @@ -112,16 +112,16 @@ define( function( require ) { label.centerY = 0; // label - node.addChild( label ); + halfMagnetNode.addChild( label ); - node.mutate( options ); + halfMagnetNode.mutate( options ); // this addresses an issue where artifacts were being left on the screen in some browser, see #48 - node.addChild( Rectangle.bounds( node.localBounds.dilated( 1 ), { + halfMagnetNode.addChild( Rectangle.bounds( halfMagnetNode.localBounds.dilated( 1 ), { fill: 'rgba( 0, 0, 0, 0 )' } ) ); - return node; + return halfMagnetNode; }; faradaysLaw.register( 'MagnetNode', MagnetNode ); diff --git a/js/faradays-law/view/MagnetNodeWithField.js b/js/faradays-law/view/MagnetNodeWithField.js index 5a20d5f4..96b02b1c 100644 --- a/js/faradays-law/view/MagnetNodeWithField.js +++ b/js/faradays-law/view/MagnetNodeWithField.js @@ -137,8 +137,8 @@ define( function( require ) { // Translate on drag events drag: function( event ) { - var point = self.globalToParentPoint( event.pointer.point ); - var desiredPosition = point.copy().subtract( magnetOffset ); + var parentPoint = self.globalToParentPoint( event.pointer.point ); + var desiredPosition = parentPoint.minus( magnetOffset ); model.moveMagnetToPosition( desiredPosition ); } } ); diff --git a/js/faradays-law/view/VoltmeterGauge.js b/js/faradays-law/view/VoltmeterGauge.js index c81d14c6..477c384f 100644 --- a/js/faradays-law/view/VoltmeterGauge.js +++ b/js/faradays-law/view/VoltmeterGauge.js @@ -32,8 +32,8 @@ define( function( require ) { var arcRadius = 55; // radius of voltmeter scale var needleColor = '#3954a5'; // blue - // scale - var scale = new Path( new Shape() + // background panel within which the needle moves + var background = new Path( new Shape() .moveTo( 0, 0 ) .lineTo( 0, -arcRadius ) .moveTo( -arcRadius, 0 ) @@ -43,7 +43,7 @@ define( function( require ) { stroke: 'black', lineWidth: 1 } ); - this.addChild( scale ); + this.addChild( background ); // plus and minus signs this.addChild( new PlusNode( {