-
Notifications
You must be signed in to change notification settings - Fork 6
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
Impedance mismatch between RangeWithValue and NumberProperty? #79
Comments
@samreid said:
Until 10/17/18 (which is actually before this issue was created), the type of NumberProperty's range option was
I don't know if it's "expected". But it's certainly possible with this implementation, and I've used that frequently. If 2 screens have models with the same NumberProperty (e.g. Ranges are also things that tend to evolve during sim design/implementation, so I typically put them in a Constants.js file, along with other things that I may need to touch frequently. I don't have a need to put a NumberProperty instance in Constant.js, because Property instances are typically not shared across screens.
The |
One other possibility would be to create a new type this.concentrationProperty = new RangeWithValueNumberProperty( concentrationRange, {
units: 'moles/liter',
tandem: options.tandem.createTandem( 'concentrationProperty' )
} ); Skimming through occurrences of @pixelzoom can you please review and advise? |
I still don't think any change is necessary. Combining Range + NumberProperty is more complicated and less flexible, and the "savings" is minimal/questionable. If you proceed with |
If you don't mind, let's defer work on this issue until after the holiday. I'd like to discuss before you proceed. |
I'm somewhat on the fence at the moment, so I'm happy to avoid implementing |
As noted above, this has nothing to do with And yes, OK to defer. |
Deferred, to be revisited no later than 11/21/2019. |
From #78
I think there's a problem with some (many?) usages of RangeWithValue. A typical usage is like this:
Why not create the NumberProperty directly in the first place? Declaring it as a RangeWithValue in one place then picking values out for the NumberProperty redundant? For example, CLBConstants.js declares:
Then the Property is declared like so:
And the
voltage
variable came from:Or is this expected because we sometimes have one range creating many Property instances (say, one per screen?)
Here's the same thing happening in BeersLawSolution:
By that token, why aren't the units associated with the range, so we could do something like this?
Or is there a better way to pass
RangeWithValue
to aNumberProperty
?Leaving self-assigned for now to think it over before discussing with other members of the team.
The text was updated successfully, but these errors were encountered: