Skip to content

Commit

Permalink
Node will addInstance for you, phetsims/phet-io#1148
Browse files Browse the repository at this point in the history
  • Loading branch information
zepumph committed Jul 6, 2017
1 parent a935490 commit b68cb56
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 29 deletions.
8 changes: 4 additions & 4 deletions js/common/view/BatteryNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ define( function( require ) {
var Text = require( 'SCENERY/nodes/Text' );
var Vector2 = require( 'DOT/Vector2' );
var capacitorLabBasics = require( 'CAPACITOR_LAB_BASICS/capacitorLabBasics' );
var TNode = require( 'SCENERY/nodes/TNode' );

// constants
var LABEL_FONT = new PhetFont( 12 );
Expand Down Expand Up @@ -114,9 +113,10 @@ define( function( require ) {
}
} );

// Register with tandem. No need to handle dispose/removeInstance since this
// exists for the lifetime of the simulation.
tandem.addInstance( this, TNode );
// tandem support
this.mutate( {
tandem: tandem
} );
}

capacitorLabBasics.register( 'BatteryNode', BatteryNode );
Expand Down
8 changes: 4 additions & 4 deletions js/common/view/CapacitorNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ define( function( require ) {
var Bounds2 = require( 'DOT/Bounds2' );
var capacitorLabBasics = require( 'CAPACITOR_LAB_BASICS/capacitorLabBasics' );
var Property = require( 'AXON/Property' );
var TNode = require( 'SCENERY/nodes/TNode' );

/**
* Constructor for a CapacitorNode.
Expand Down Expand Up @@ -64,9 +63,10 @@ define( function( require ) {
eFieldNode.setVisible( visible );
} );

// Register with tandem. No need to handle dispose/removeInstance since this
// exists for the lifetime of the simulation.
tandem.addInstance( this, TNode );
// tandem support
this.mutate( {
tandem: tandem
} );
}

capacitorLabBasics.register( 'CapacitorNode', CapacitorNode );
Expand Down
8 changes: 4 additions & 4 deletions js/common/view/SwitchNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ define( function( require ) {
var ButtonListener = require( 'SCENERY/input/ButtonListener' );
var Vector2 = require( 'DOT/Vector2' );
var WireNode = require( 'CAPACITOR_LAB_BASICS/common/view/WireNode' );
var TNode = require( 'SCENERY/nodes/TNode' );

// Images
var switchCueArrowImage = require( 'image!CAPACITOR_LAB_BASICS/switch_cue_arrow.png' );
Expand Down Expand Up @@ -229,9 +228,10 @@ define( function( require ) {
}
} ) );

// Register with tandem. No need to handle dispose/removeInstance since this
// exists for the lifetime of the simulation.
tandem.addInstance( this, TNode );
// tandem support
this.mutate( {
tandem: tandem
} );
}

capacitorLabBasics.register( 'SwitchNode', SwitchNode );
Expand Down
8 changes: 4 additions & 4 deletions js/common/view/control/VoltmeterToolBoxPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ define( function( require ) {
var CLBConstants = require( 'CAPACITOR_LAB_BASICS/common/CLBConstants' );
var capacitorLabBasics = require( 'CAPACITOR_LAB_BASICS/capacitorLabBasics' );
var Node = require( 'SCENERY/nodes/Node' );
var TNode = require( 'SCENERY/nodes/TNode' );

/**
* @constructor
Expand Down Expand Up @@ -78,9 +77,10 @@ define( function( require ) {
}
} );

// Register with tandem. No need to handle dispose/removeInstance since this
// exists for the lifetime of the simulation.
tandem.addInstance( this, TNode );
// tandem support
this.mutate( {
tandem: tandem
} );
}

capacitorLabBasics.register( 'VoltmeterToolBoxPanel', VoltmeterToolBoxPanel );
Expand Down
7 changes: 4 additions & 3 deletions js/common/view/drag/PlateAreaDragHandleNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ define( function( require ) {
var PlateAreaDragHandler = require( 'CAPACITOR_LAB_BASICS/common/view/drag/PlateAreaDragHandler' );
var UnitsUtils = require( 'CAPACITOR_LAB_BASICS/common/model/util/UnitsUtils' );
var Vector2 = require( 'DOT/Vector2' );
var TNode = require( 'SCENERY/nodes/TNode' );

// constants
// endpoints for a vertical double-headed arrow, this will be rotated to point along the plate's pseudo-3D diagonal
Expand Down Expand Up @@ -120,8 +119,10 @@ define( function( require ) {
self.updateOffset();
} );

tandem.addInstance( this, TNode );
}
// tandem support
this.mutate( {
tandem: tandem
} ); }

capacitorLabBasics.register( 'PlateAreaDragHandleNode', PlateAreaDragHandleNode );

Expand Down
6 changes: 4 additions & 2 deletions js/common/view/drag/PlateSeparationDragHandleNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ define( function( require ) {
var PlateSeparationDragHandler = require( 'CAPACITOR_LAB_BASICS/common/view/drag/PlateSeparationDragHandler' );
var UnitsUtils = require( 'CAPACITOR_LAB_BASICS/common/model/util/UnitsUtils' );
var Vector2 = require( 'DOT/Vector2' );
var TNode = require( 'SCENERY/nodes/TNode' );

// constants
// endpoints for vertical double-headed arrow
Expand Down Expand Up @@ -113,7 +112,10 @@ define( function( require ) {
self.updateOffset();
} );

tandem.addInstance( this, TNode );
// tandem support
this.mutate( {
tandem: tandem
} );
}

capacitorLabBasics.register( 'PlateSeparationDragHandleNode', PlateSeparationDragHandleNode );
Expand Down
8 changes: 4 additions & 4 deletions js/common/view/meters/BarMeterNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ define( function( require ) {
var Util = require( 'DOT/Util' );
var ArrowNode = require( 'SCENERY_PHET/ArrowNode' );
var capacitorLabBasics = require( 'CAPACITOR_LAB_BASICS/capacitorLabBasics' );
var TNode = require( 'SCENERY/nodes/TNode' );

// constants
var BASE_LINE_LENGTH = 25; // Length of vertical line at the origin (left end) of the bar
Expand Down Expand Up @@ -104,9 +103,10 @@ define( function( require ) {

this.updateLayout();

// Register with tandem. No need to handle dispose/removeInstance since this
// exists for the lifetime of the simulation.
tandem.addInstance( this, TNode );
// tandem support
this.mutate( {
tandem: tandem
} );
}

capacitorLabBasics.register( 'BarMeterNode', BarMeterNode );
Expand Down
8 changes: 4 additions & 4 deletions js/common/view/meters/VoltmeterNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ define( function( require ) {
var Path = require( 'SCENERY/nodes/Path' );
var Shape = require( 'KITE/Shape' );
var Text = require( 'SCENERY/nodes/Text' );
var TNode = require( 'SCENERY/nodes/TNode' );

// strings
var voltageString = require( 'string!CAPACITOR_LAB_BASICS/voltage' );
Expand Down Expand Up @@ -92,9 +91,10 @@ define( function( require ) {
} ) );
}

// Register with tandem. No need to handle dispose/removeInstance since this
// exists for the lifetime of the simulation.
tandem.addInstance( this, TNode );
// tandem support
this.mutate( {
tandem: tandem
} );
}

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

0 comments on commit b68cb56

Please sign in to comment.