Skip to content

Commit

Permalink
Clean up unused SoccerBall options - see #172
Browse files Browse the repository at this point in the history
  • Loading branch information
matthew-blackman committed May 11, 2023
1 parent 2651acc commit d65b5a8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 15 deletions.
6 changes: 1 addition & 5 deletions js/common/model/CAVSceneModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,9 @@ export default abstract class CAVSceneModel extends PhetioObject implements TMod
range: new Range( 0, this.maxKicksLimit )
} );
this.soccerBalls = _.range( 0, this.maxKicksLimit ).map( index => {

const position = new Vector2( 0, CAVObjectType.SOCCER_BALL.radius );

const soccerBall = new SoccerBall( {
isFirstObject: index === 0,
tandem: options.tandem.createTandem( 'soccerBalls' ).createTandem( `soccerBall${index}` ),
position: position
tandem: options.tandem.createTandem( 'soccerBalls' ).createTandem( `soccerBall${index}` )
} );

// When the soccer ball drag position changes, constrain it to the physical range and move it to the top, if necessary
Expand Down
14 changes: 4 additions & 10 deletions js/common/model/SoccerBall.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@ import TEmitter from '../../../../axon/js/TEmitter.js';
import SoccerPlayer from './SoccerPlayer.js';

type SelfOptions = {
position?: Vector2;
velocity?: Vector2;
value?: number | null;
isFirstObject?: boolean;
};
export type CAVObjectOptions =
Expand Down Expand Up @@ -76,9 +73,6 @@ export default class SoccerBall extends PhetioObject {
public constructor( providedOptions: CAVObjectOptions ) {

const options = optionize<CAVObjectOptions, SelfOptions, PhetioObjectOptions>()( {
position: Vector2.ZERO,
velocity: Vector2.ZERO,
value: null,
isFirstObject: false
}, providedOptions );

Expand All @@ -89,19 +83,19 @@ export default class SoccerBall extends PhetioObject {

this.isFirstObject = options.isFirstObject;

this.positionProperty = new Vector2Property( options.position, {
this.positionProperty = new Vector2Property( new Vector2( 0, CAVObjectType.SOCCER_BALL.radius ), {
tandem: options.tandem.createTandem( 'positionProperty' ),
valueComparisonStrategy: 'equalsFunction',
phetioReadOnly: true
} );
this.velocityProperty = new Vector2Property( options.velocity, {
this.velocityProperty = new Vector2Property( new Vector2( 0, 0 ), {
tandem: options.tandem.createTandem( 'velocityProperty' )
} );
this.animationModeProperty = new EnumerationProperty( AnimationMode.NONE, {
tandem: options.tandem.createTandem( 'animationModeProperty' )
} );
this.dragPositionProperty = new Vector2Property( options.position );
this.valueProperty = new Property<number | null>( options.value, {
this.dragPositionProperty = new Vector2Property( this.positionProperty.value.copy() );
this.valueProperty = new Property<number | null>( null, {
tandem: options.tandem.createTandem( 'valueProperty' ),
phetioValueType: NullableIO( NumberIO )
} );
Expand Down

0 comments on commit d65b5a8

Please sign in to comment.