TwoValueVertical Sliders upside-down?


#1

Hi,

I’m implementing some range sliders as Sliders of style TwoValueVertical in JUCE (v. 1.46). Their values are upside-down with respect to their one-valued counterparts. It seems that changing the relevant lines in Slider::getLinearSliderPos,

if (style == LinearVertical || style == IncDecButtons) sliderPosProportional = 1.0 - sliderPosProportional;

to ask if a slider isVertical(), could fix this. As always, there may be a good reason for the existing behavior that I’m missing, or the change may simply break existing apps by now, in which case I hope there can be an option to invert them.

best,
Randy


#2

Hmm - that does seem a bit odd, I think it was probably just an oversight. Would anybody’s app get compromised if I flipped them around?


#3

OK, it works for me after the following changes to juce_Slider.cpp.

735c735
<     if (style == LinearVertical || style == IncDecButtons)
---
>     if (isVertical() || style == IncDecButtons)
1238c1238
<                     if (style == LinearVertical)
---
>                     if (isVertical())
1264c1264
<                     if (style == LinearVertical || style == RotaryVerticalDrag
---
>                     if (isVertical() || style == RotaryVerticalDrag

#4

Thanks. Since nobody replied to this post saying “no, no, please don’t change it!”, then I’ll assume it’s ok to swap it over!