# Rotary slider with negative values

**URL:** <https://forum.juce.com/t/rotary-slider-with-negative-values/57838>\
**Category:** General JUCE discussion\
**Created:** [September 13, 2023, 2:16am UTC](https://forum.juce.com/t/rotary-slider-with-negative-values/57838 "2023-09-13T02:16:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nobodi](https://avatars.discourse-cdn.com/v4/letter/n/e9c0ed/32.png) [@Nobodi](https://forum.juce.com/u/Nobodi)\
**Post date:** [September 13, 2023, 2:16am UTC](https://forum.juce.com/t/rotary-slider-with-negative-values/57838/1 "2023-09-13T02:16:18Z")

</div>

Hi all,

I’m trying to implement a rotary slider that functions like a wheel rather than a knob. I would like it for it to be able to take values between -infinity and infinity. In other words, it should spin continuously until the user decides to stop and it should take on larger and larger negative numbers, or larger and larger positive numbers.

As it stands, it implements a range of 0.00 to 9.99. Negative values are effectively mod 10.00, as are positive numbers. If I rotate it counter clockwise, the numbers descend until 0.00, then jump to 9.99 and continue descending.

Is there a way to implement a rotary slider that can go continuously negative and positive?

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![duvrin](https://avatars.discourse-cdn.com/v4/letter/d/a88e4f/32.png) [@duvrin](https://forum.juce.com/u/duvrin)\
**Post date:** [September 13, 2023, 5:10am UTC](https://forum.juce.com/t/rotary-slider-with-negative-values/57838/2 "2023-09-13T05:10:47Z")

</div>

Derive a new class from jute::Slider, use the slider’s value as a proxy value, override some methods to keep track on how many cycles the slider has performed since mouseDown, and extract your (-inf,+inf) desired value based on that. Meaning that the perceived value used by the wheel is not the slider’s value object, but a class member of your custom slider.

---

<div class="post-metadata">

**Author:** ![Nobodi](https://avatars.discourse-cdn.com/v4/letter/n/e9c0ed/32.png) [@Nobodi](https://forum.juce.com/u/Nobodi)\
**Post date:** [September 14, 2023, 2:41am UTC](https://forum.juce.com/t/rotary-slider-with-negative-values/57838/3 "2023-09-14T02:41:04Z")

</div>

I’ll give this a shot. Thanks!
