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

**URL:** <https://forum.juce.com/t/request-rotary-slider-needs-an-extra-value-for-the-start-point-of-visualisation/22745>\
**Category:** General JUCE discussion\
**Created:** [June 3, 2017, 11:47am UTC](https://forum.juce.com/t/request-rotary-slider-needs-an-extra-value-for-the-start-point-of-visualisation/22745 "2017-06-03T11:47:40Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![chkn](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/chkn/32/3862_2.png) [@chkn](https://forum.juce.com/u/chkn)\
**Post date:** [June 3, 2017, 11:47am UTC](https://forum.juce.com/t/request-rotary-slider-needs-an-extra-value-for-the-start-point-of-visualisation/22745/1 "2017-06-03T11:47:40Z")

</div>

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

![](https://us1.discourse-cdn.com/flex026/uploads/juce/original/2X/e/ea66fd202299fe5dd83b5d56917286819baba2e6.png)

---

<div class="post-metadata">

**Author:** ![daniel](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/daniel/32/790_2.png) [@daniel](https://forum.juce.com/u/daniel)\
**Post date:** [June 3, 2017, 12:22pm UTC](https://forum.juce.com/t/request-rotary-slider-needs-an-extra-value-for-the-start-point-of-visualisation/22745/2 "2017-06-03T12:22:09Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![chkn](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/chkn/32/3862_2.png) [@chkn](https://forum.juce.com/u/chkn)\
**Post date:** [June 6, 2017, 6:39am UTC](https://forum.juce.com/t/request-rotary-slider-needs-an-extra-value-for-the-start-point-of-visualisation/22745/3 "2017-06-06T06:39:15Z")

</div>

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

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

---

<div class="post-metadata">

**Author:** ![chkn](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/chkn/32/3862_2.png) [@chkn](https://forum.juce.com/u/chkn)\
**Post date:** [August 9, 2018, 2:11pm UTC](https://forum.juce.com/t/request-rotary-slider-needs-an-extra-value-for-the-start-point-of-visualisation/22745/4 "2018-08-09T14:11:26Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![JussiNeuralDSP](https://avatars.discourse-cdn.com/v4/letter/j/c68b51/32.png) [@JussiNeuralDSP](https://forum.juce.com/u/JussiNeuralDSP)\
**Post date:** [August 9, 2018, 2:43pm UTC](https://forum.juce.com/t/request-rotary-slider-needs-an-extra-value-for-the-start-point-of-visualisation/22745/5 "2018-08-09T14:43:24Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![chkn](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/chkn/32/3862_2.png) [@chkn](https://forum.juce.com/u/chkn)\
**Post date:** [August 9, 2018, 4:34pm UTC](https://forum.juce.com/t/request-rotary-slider-needs-an-extra-value-for-the-start-point-of-visualisation/22745/6 "2018-08-09T16:34:08Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![sonictolfa](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/sonictolfa/32/16346_2.png) [@sonictolfa](https://forum.juce.com/u/sonictolfa)\
**Post date:** [February 27, 2019, 2:49pm UTC](https://forum.juce.com/t/request-rotary-slider-needs-an-extra-value-for-the-start-point-of-visualisation/22745/7 "2019-02-27T14:49:17Z")

</div>

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

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?

---

<div class="post-metadata">

**Author:** ![alassandro](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/alassandro/32/4297_2.png) [@alassandro](https://forum.juce.com/u/alassandro)\
**Post date:** [February 27, 2019, 4:53pm UTC](https://forum.juce.com/t/request-rotary-slider-needs-an-extra-value-for-the-start-point-of-visualisation/22745/8 "2019-02-27T16:53:16Z")

</div>

Maybe something like this could be included in the [`RotaryParameters`](https://docs.juce.com/master/structSlider_1_1RotaryParameters.html) struct
