Request: (rotary) Slider needs an extra-value for the start-point of visualisation

Sliders needs extra-value for the start-point of visualisation, an good example is a pan-slider.

Its only the value (get/Setter functions) which needs to be stored, the rest can be done via the look and feel classes

1 Like

That is a nice enhancement, but meanwhile you can achieve this also only the look and feel (but not adjustable).
I changed in LookAndFeel_V2::drawRotarySlider:

    {
        Path filledArc;
        filledArc.addPieSegment (rx, ry, rw, rw, rotaryStartAngle, angle, thickness);
        g.fillPath (filledArc);
    }

to be

    {
        Path filledArc;
        const float rotaryMidAngle = 0.5f * (rotaryStartAngle + rotaryEndAngle);
        if (angle > rotaryMidAngle)
            filledArc.addPieSegment (rx, ry, rw, rw, rotaryMidAngle, angle, thickness);
        else
            filledArc.addPieSegment (rx, ry, rw, rw, angle, rotaryMidAngle, thickness);
        g.fillPath (filledArc);
    }

The drawback is, you need an extra lookandfeel just for the pan button, so your addition to have the rotaryMidAngle adjustable would be nice. Could be either also in radians or between 0…1.

2 Likes

Thanks! Yes thats my plan, but it would be great if something like this will be inluded in Juce.

slider->setPieSegmentMidAngle(…)
slider->getPieSegmentMidAngle()

1 Like

request: the slider-class needs the variable and get/set function for storing such value.
PS: yes i could subclass slider, but it feels quirky to retrieve the value via dynamic_cast inside the Look&Feel method

You can store any data in NamedValueSet that you can access with Component::getProperties(). Then you can check if properties contains the requested key and use it’s value.

  • Jussi
3 Likes

Thanks for the hint, yes i know (but this is a request :wink:

I have used the component properties for this for now. Cheers @JussiNeuralDSP for the tip! :grinning:

As @chkn said, this would be a great feature to have out of the box (for rotary and linear sliders). Any chance that something similar could be added into JUCE?

Maybe something like this could be included in the RotaryParameters struct

2 Likes