-
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
We need a FrequencySlider #371
Comments
For instance, we could go with |
It also crossed my mind that we might be able to flip the slider with a scenery node scale (-1,1), but is that a hack? |
Indeed, putting |
I renamed the issue to "We need a frequency slider" because if you only reverse the wavelengths, you do not have the right "spacing" between frequency points. That is, we will want the transform to be linear in frequency (not -1/Hz), which is different. The WavelengthSlider currently has an api: I'll hold off until I can discuss the API with @pixelzoom. |
It sounds to me like there are enough differences that we may want to create a new |
I made working copy changes to create SpectrumSlider with subclasses WavelengthSlider and FrequencySlider. I tested Beer's Law Lab (which uses WavelengthSlider) is working OK. I added a scenery-phet test for the FrequencySlider here: http://localhost/scenery-phet/scenery-phet_en.html?screens=2&component=FrequencySlider I confirmed the WavelengthSlider in the scenery-phet demo still works OK.
Initial commit forthcoming. |
After initial commit, I'll proceed with the renamings mentioned above. |
I renamed SpectrumNode => WavelengthSpectrumNode and confirmed it looks identical in Molecules and Light. Committing. |
I won't have time to look at this until next week. But hopefully none of these changes make it difficult to add UV and IR to WavelengthSlider, as is required for #211 (needed by MOTHA). |
I introduced a new type |
I finished creating FrequencySlider, kept the same interface for WavelengthSlider, and renamed SpectrumNode => WavelengthSpectrumNode. I recommend the changes be reviewed since (a) they are used in several sims (b) they will affect how we proceed with #211 and (c) I have some questions for the reviewer:
More notes for the reviewer:
@ariel-phet can you please prioritize/schedule/delegate? |
@samreid said:
I see both SpectrumNode and WavelengthSpectrumNode in scenery-phet, both with commits on 4/13/2018. Please clarify. |
I see these assertions in FrequencySlider and WavelengthSlider: assert && assert( typeof options.minValue === 'undefined', 'minValue is supplied by FrequencySlider' );
assert && assert( typeof options.maxValue === 'undefined', 'maxValue is supplied by FrequencySlider' ); Why not this? assert && assert( options.minValue === undefined, 'minValue is supplied by FrequencySlider' );
assert && assert( options.maxValue === undefined, 'maxValue is supplied by FrequencySlider' ); |
@samreid asked:
I have no recollection. If you remove it, test thoroughly.
New code should use the new pattern. FrequencySlider is new code.
No idea. Probably a question for designers. |
Playing with FrequencySlider in the scenery-phet demo... the arrow buttons don't work. |
Review completed, see comments above. Tested the sims I'm responsible for that use WavelengthSlider and I don't see any bugs introduced. |
From the docs: /**
* SpectrumNode displays a spectrum from one value to another. The displayed colors are computed by a
* required valueToColor function.
*
* @author Chris Malley (PixelZoom, Inc.)
* @author Sam Reid (PhET Interactive Simulations)
*/
/**
* WavelengthSpectrumNode displays a rectangle of the visible spectrum.
*
* @author Chris Malley (PixelZoom, Inc.)
* @author Sam Reid (PhET Interactive Simulations)
*/ WavelengthSpectrumNode extends SpectrumNode. |
From #371 (comment) The question is about whether to use |
Remaining work:
|
I addressed the issues raised during review, @pixelzoom anything else to do before closing? |
Signed-off-by: Chris Malley <[email protected]>
At the Wave Interference design meeting, we concluded we need to be able to reverse the WavelengthSlider, so that the high frequencies are shown to the right instead of the left (that is, we are using it as a "Frequency" slider instead of a Wavelength slider.)
My initial thought for the API would be to add an option like:
increasingWavelength: true
or maybe something like:
blueOnTheLeft: true
However, I realized that if I swapped the min and max like so:
and disabled the corresponding assertion statements that checked that min < max, then it rendered properly (though the input listener was broken):
However, if we stick with that pattern, then min and max may not be the best prefixes (since max would be greater than min).
@pixelzoom can you please recommend an API for this before I proceed?
The text was updated successfully, but these errors were encountered: