Skip to content

Commit

Permalink
Use Vector2Property, see phetsims/dot#88
Browse files Browse the repository at this point in the history
  • Loading branch information
samreid committed Mar 6, 2019
1 parent 631aac1 commit 4c7812f
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 20 deletions.
7 changes: 3 additions & 4 deletions js/model/Ammeter.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ define( require => {
const Property = require( 'AXON/Property' );
const PropertyIO = require( 'AXON/PropertyIO' );
const Vector2 = require( 'DOT/Vector2' );
const Vector2IO = require( 'DOT/Vector2IO' );
const Vector2Property = require( 'DOT/Vector2Property' );

class Ammeter extends Meter {

Expand All @@ -36,9 +36,8 @@ define( require => {
} );

// @public {Property.<Vector2>} - the position of the tip of the probe
this.probePositionProperty = new Property( Vector2.ZERO, {
tandem: tandem.createTandem( 'probePositionProperty' ),
phetioType: PropertyIO( Vector2IO )
this.probePositionProperty = new Vector2Property( Vector2.ZERO, {
tandem: tandem.createTandem( 'probePositionProperty' )
} );
}

Expand Down
9 changes: 3 additions & 6 deletions js/model/Meter.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,8 @@ define( require => {
const Bounds2 = require( 'DOT/Bounds2' );
const circuitConstructionKitCommon = require( 'CIRCUIT_CONSTRUCTION_KIT_COMMON/circuitConstructionKitCommon' );
const Emitter = require( 'AXON/Emitter' );
const Property = require( 'AXON/Property' );
const PropertyIO = require( 'AXON/PropertyIO' );
const Vector2 = require( 'DOT/Vector2' );
const Vector2IO = require( 'DOT/Vector2IO' );
const Vector2Property = require( 'DOT/Vector2Property' );

class Meter {

Expand All @@ -31,9 +29,8 @@ define( require => {
} );

// @public {Property.<Vector2>} - the location of the body of the meter
this.bodyPositionProperty = new Property( Vector2.ZERO, {
tandem: tandem.createTandem( 'bodyPositionProperty' ),
phetioType: PropertyIO( Vector2IO )
this.bodyPositionProperty = new Vector2Property( Vector2.ZERO, {
tandem: tandem.createTandem( 'bodyPositionProperty' )
} );

// @public {Property.<boolean>} When the meter is dragged from the toolbox, all pieces drag together.
Expand Down
6 changes: 2 additions & 4 deletions js/model/Vertex.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@ define( require => {
const Emitter = require( 'AXON/Emitter' );
const NumberProperty = require( 'AXON/NumberProperty' );
const Property = require( 'AXON/Property' );
const PropertyIO = require( 'AXON/PropertyIO' );
const Tandem = require( 'TANDEM/Tandem' );
const Vector2IO = require( 'DOT/Vector2IO' );
const Vector2Property = require( 'DOT/Vector2Property' );

// Index counter for debugging
let counter = 0;
Expand Down Expand Up @@ -47,9 +46,8 @@ define( require => {
this.vertexTandem = options.tandem;

// @public {Property.<Vector2>} - location of the vertex
this.positionProperty = new Property( position, {
this.positionProperty = new Vector2Property( position, {
tandem: options.tandem && options.tandem.createTandem( 'positionProperty' ),
phetioType: PropertyIO( Vector2IO ),
useDeepEquality: true,
isValidValue: assert && ( p => !isNaN( p.x ) && !isNaN( p.y ) )
} );
Expand Down
10 changes: 4 additions & 6 deletions js/model/Voltmeter.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ define( require => {
const Property = require( 'AXON/Property' );
const PropertyIO = require( 'AXON/PropertyIO' );
const Vector2 = require( 'DOT/Vector2' );
const Vector2IO = require( 'DOT/Vector2IO' );
const Vector2Property = require( 'DOT/Vector2Property' );

class Voltmeter extends Meter {

Expand All @@ -35,15 +35,13 @@ define( require => {
} );

// @public {Property.<Vector2>} - the position of the tip of the red probe in model=view coordinates.
this.redProbePositionProperty = new Property( Vector2.ZERO, {
tandem: tandem.createTandem( 'redProbePositionProperty' ),
phetioType: PropertyIO( Vector2IO )
this.redProbePositionProperty = new Vector2Property( Vector2.ZERO, {
tandem: tandem.createTandem( 'redProbePositionProperty' )
} );

// @public {Property.<Vector2>} - the position of the black probe in model=view coordinates
this.blackProbePositionProperty = new Property( Vector2.ZERO, {
tandem: tandem.createTandem( 'blackProbePositionProperty' ),
phetioType: PropertyIO( Vector2IO )
tandem: tandem.createTandem( 'blackProbePositionProperty' )
} );
}

Expand Down

0 comments on commit 4c7812f

Please sign in to comment.