phetsims / scenery-phet

Reusable components based on Scenery that are specific to PhET simulations.
MIT License
8 stars 6 forks source link

Add support for vertical slider to NumberControl #836

Closed pixelzoom closed 8 months ago

pixelzoom commented 8 months ago

For https://github.com/phetsims/faradays-electromagnetic-lab/issues/61, I need 2 NumberControl instances for the AC Power Supply. One of them needs to be a vertical slider, see screenshot below. Unfortunately, NumberControl does not currently support vertical sliders, because of this:

428     this.slider = new HSlider( numberProperty, numberRange, options.sliderOptions );

Fingers crossed that this is a simple matter of changing HSlider to Slider.

screenshot_2996
pixelzoom commented 8 months ago

Done in the above commit. I also added a vertical NumberControl to the scenery-phet demo, see screenshot below.

I did NOT add the ability to change the arrow buttons to point up/down, something that might be needed. I don't need that for https://github.com/phetsims/faradays-electromagnetic-lab/issues/61. So since there's no actual use for it yet, the person who needs it will need to add that feature.

Random selection chose @zepumph for a review. If you don't have time, assign back to me and I'll choose someone else.

screenshot_2998
zepumph commented 8 months ago

Very good! All other usages of horizontal and vertical have to do with individual layout functions. The demo looks good. Thanks!