-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Should we create DOT/Range.times or equivalent? #123
Comments
I see 3 places where a Range I don't see how Range // REVIEW - Consider a Range method for this, see https://github.com/phetsims/faradays-electromagnetic-lab/issues/123
this.loopRadiusRange = new Range(
Math.sqrt( ( this.loopAreaPercentProperty.range.min / 100 ) * options.maxLoopArea / Math.PI ),
Math.sqrt( ( this.loopAreaPercentProperty.range.max / 100 ) * options.maxLoopArea / Math.PI )
); |
Good point! We didn't see the |
For 3 of the 4 places where I could use Range For the Here's the implementation of Range /**
* Returns new Range instance, created by scaling this Range's min and max by the provided scalar value.
*/
public times( scalar: number ): Range {
// eslint-disable-next-line no-html-constructors
return new Range( scalar * this.min, scalar * this.max );
} |
Discovered in #103, there at least 4 occurrences in the simulation where a Range is used to create a scaled/transformed Range. This is leading to a little bit of duplicated code and an opportunity to add a new feature to Range. Range already has
shifted
so there is a precedent for this kind of method.For instance:
could become something like:
The text was updated successfully, but these errors were encountered: