Skip to content

Commit

Permalink
address REVIEW comment via this.maxDiameter, #154
Browse files Browse the repository at this point in the history
  • Loading branch information
pixelzoom committed Sep 15, 2021
1 parent b461441 commit 2b991dc
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions js/common/model/Optic.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ class Optic {
assert && assert( radiusOfCurvatureRange instanceof RangeWithValue, 'invalid radiusOfCurvature' );
assert && assert( diameterRange instanceof RangeWithValue, 'invalid diameterRange' );

// @private {RangeWithValue}
this.maxDiameter = diameterRange.max;

// @public {Property.<Vector2>} Position of the optical element
this.positionProperty = new Vector2Property( initialPosition );

Expand Down Expand Up @@ -92,11 +95,6 @@ class Optic {
[ this.radiusOfCurvatureProperty, this.diameterProperty, this.curveProperty ],
( radius, diameter, curve ) => new OpticShapeCollection( radius, diameter, curve, type )
);

// REVIEW: correct typedoc would be helpful here. Is it supported to just be a {Range}, or does it actually need to
// be one with a value now that the value was given to the NumberProperty above? @private {number} diameter of the
// optic
this.diameterRange = diameterRange;
}

/**
Expand Down Expand Up @@ -236,7 +234,7 @@ class Optic {
* @returns {number}
*/
getNormalizedDiameter( diameter ) {
return diameter / this.diameterRange.max;
return diameter / this.maxDiameter;
}

/**
Expand Down

0 comments on commit 2b991dc

Please sign in to comment.