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 2e54751 commit 05d2bca
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 17 deletions.
12 changes: 5 additions & 7 deletions js/model/Particle.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ define( function( require ) {
var ShredConstants = require( 'SHRED/ShredConstants' );
var Tandem = require( 'TANDEM/Tandem' );
var Vector2 = require( 'DOT/Vector2' );
var Vector2IO = require( 'DOT/Vector2IO' );
var Vector2Property = require( 'DOT/Vector2Property' );

// constants
var DEFAULT_PARTICLE_VELOCITY = 200; // Basically in pixels/sec.
Expand All @@ -46,15 +46,13 @@ define( function( require ) {
this.type = type; // @public (read-only)

// @public
this.positionProperty = new Property( Vector2.ZERO, {
this.positionProperty = new Vector2Property( Vector2.ZERO, {
useDeepEquality: true,
tandem: options.tandem && options.tandem.createTandem( 'positionProperty' ),
phetioType: PropertyIO( Vector2IO )
tandem: options.tandem && options.tandem.createTandem( 'positionProperty' )
} );
this.destinationProperty = new Property( Vector2.ZERO, {
this.destinationProperty = new Vector2Property( Vector2.ZERO, {
useDeepEquality: true,
tandem: options.tandem && options.tandem.createTandem( 'destinationProperty' ),
phetioType: PropertyIO( Vector2IO )
tandem: options.tandem && options.tandem.createTandem( 'destinationProperty' )
} );
this.radiusProperty = new NumberProperty( type === 'electron' ? ShredConstants.ELECTRON_RADIUS : ShredConstants.NUCLEON_RADIUS, {
tandem: options.tandem && options.tandem.createTandem( 'radiusProperty' ),
Expand Down
16 changes: 6 additions & 10 deletions js/model/ParticleAtom.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,12 @@ define( function( require ) {
var ParticleAtomIO = require( 'SHRED/model/ParticleAtomIO' );
var ParticleIO = require( 'SHRED/model/ParticleIO' );
var PhetioObject = require( 'TANDEM/PhetioObject' );
var Property = require( 'AXON/Property' );
var PropertyIO = require( 'AXON/PropertyIO' );
var shred = require( 'SHRED/shred' );
var ShredConstants = require( 'SHRED/ShredConstants' );
var Tandem = require( 'TANDEM/Tandem' );
var Utils = require( 'SHRED/Utils' );
var Vector2 = require( 'DOT/Vector2' );
var Vector2IO = require( 'DOT/Vector2IO' );
var Vector2Property = require( 'DOT/Vector2Property' );

// constants
var NUM_ELECTRON_POSITIONS = 10; // first two electron shells, i.e. 2 + 8
Expand Down Expand Up @@ -57,15 +55,13 @@ define( function( require ) {
this.nucleusRadius = 0;

// @public
this.positionProperty = new Property( Vector2.ZERO, {
this.positionProperty = new Vector2Property( Vector2.ZERO, {
useDeepEquality: true,
tandem: options.tandem.createTandem( 'positionProperty' ),
phetioType: PropertyIO( Vector2IO )
tandem: options.tandem.createTandem( 'positionProperty' )
} );
this.nucleusOffsetProperty = new Property( Vector2.ZERO, {
this.nucleusOffsetProperty = new Vector2Property( Vector2.ZERO, {
useDeepEquality: true,
tandem: options.tandem.createTandem( 'nucleusOffsetProperty' ),
phetioType: PropertyIO( Vector2IO )
tandem: options.tandem.createTandem( 'nucleusOffsetProperty' )
} );

// @private - particle collections
Expand Down Expand Up @@ -393,7 +389,7 @@ define( function( require ) {
else {
throw new Error( 'Attempt to remove particle that is not in this particle atom.' );
}
assert && assert( typeof( particle.particleAtomRemovalListener ) === 'function',
assert && assert( typeof ( particle.particleAtomRemovalListener ) === 'function',
'No particle removal listener attached to particle.' );
particle.userControlledProperty.unlink( particle.particleAtomRemovalListener );

Expand Down

0 comments on commit 05d2bca

Please sign in to comment.