Skip to content

Commit

Permalink
Fix types for Reading, see #401
Browse files Browse the repository at this point in the history
  • Loading branch information
samreid committed Oct 11, 2021
1 parent 39347ef commit 4deca4f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions js/common/model/IntensityMeter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class IntensityMeter {
*/
constructor( sensorX: number, sensorY: number, bodyX: number, bodyY: number ) {

this.readingProperty = new Property( 'miss' ); // @public, value to show on the body
this.readingProperty = new Property( Reading.MISS ); // @public, value to show on the body
this.sensorPositionProperty = new Vector2Property( new Vector2( sensorX, sensorY ) ); // @public
this.bodyPositionProperty = new Vector2Property( new Vector2( bodyX, bodyY ) ); // @public
this.enabledProperty = new Property( false ); // @public, True if it is in the play area
Expand Down Expand Up @@ -79,7 +79,7 @@ class IntensityMeter {
*/
clearRayReadings() {
this.rayReadings = [];
this.readingProperty.set( 'miss' );
this.readingProperty.set( Reading.MISS );
}

/**
Expand All @@ -106,9 +106,9 @@ class IntensityMeter {
}
} );

// if not hits, say "MISS"
// if no hits, say "MISS"
if ( hits.length === 0 ) {
this.readingProperty.set( 'miss' );
this.readingProperty.set( Reading.MISS );
}
else {

Expand Down
6 changes: 3 additions & 3 deletions js/common/view/IntensityMeterNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ class IntensityMeterNode extends Node {
}

// Add the reading to the body node
const valueNode = new Text( intensityMeter.readingProperty.get(), {
const valueNode = new Text( intensityMeter.readingProperty.get().getString(), {
font: new PhetFont( 25 ),
fill: 'black',
maxWidth: valueBackground.width * 0.85
Expand All @@ -111,8 +111,8 @@ class IntensityMeterNode extends Node {
titleNode.centerX = outerRectangle.centerX;

// displayed value
intensityMeter.readingProperty.link( ( reading: Reading | string ) => {
valueNode.setText( typeof reading === 'string' ? reading : reading.getString() );
intensityMeter.readingProperty.link( ( reading: Reading ) => {
valueNode.setText( reading.getString() );
valueNode.center = valueBackground.center;
} );

Expand Down

0 comments on commit 4deca4f

Please sign in to comment.