TwoValueVertical Sliders upside-down?


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.


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?

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

<     if (style == LinearVertical || style == IncDecButtons)
>     if (isVertical() || style == IncDecButtons)
<                     if (style == LinearVertical)
>                     if (isVertical())
<                     if (style == LinearVertical || style == RotaryVerticalDrag
>                     if (isVertical() || style == RotaryVerticalDrag

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!