Weird assertions in Slider::setRotaryParameters?



Slider::setRotaryParameters ( looks like this:

void setRotaryParameters (const float startAngleRadians,
                          const float endAngleRadians,
                          const bool stopAtEnd)
    // make sure the values are sensible..
    jassert (rotaryStart >= 0 && rotaryEnd >= 0);
    jassert (rotaryStart < float_Pi * 4.0f && rotaryEnd < float_Pi * 4.0f);
    jassert (rotaryStart < rotaryEnd);

    rotaryStart = startAngleRadians;
    rotaryEnd = endAngleRadians;
    rotaryStop = stopAtEnd;

It looks like the assertions validate the old values rather than the new values, and would only fire if someone sets bad values and then sets values again.. Would probably make more sense to move the assertions to the end.

Cheers, Yair

Slider::setRotaryParameters asserts

Yeah, good point. Probably an artifact of code getting moved around over the years.


Another question regarding this assertion:

jassert (startAngleRadians < endAngleRadians);

Is this assertion really necessary? It seems that without it all works fine and then the slider also supports setting counter-clockwise rotation as the "positive direction". (tested with the standard look and feel, Laf_V2, Laf_V1, and our custom Laf and it works well in all)

I got a design from our designer where half-circle rotary sliders are at the sides of the window where in all of them up is positive (for example more gain / more drive). So on those from the left I actually want the positive direction be counter-clockwise.

Cheers, Yair