Invert mouse wheel response over a slider
-
I am trying to invert the response of a mouse wheel so that when the mouse wheel is pushed up, the values of a knob/slider decrease.
Is it possible to do this, and if so, how? -
Do you want this behavior only for the mouse wheel? So clicking and dragging moves the slider values normally?
-
@ally Actually, all of it could be reversed, click+drag, and scroll wheel.
-
@gorangrooves You could do it a few different ways depending on what exactly you're looking for/what your setup is... If you're using a sprite sheet, you could export it in reverse order, then in the slider's custom callback, set whatever it controls to the max possible value minus the current value (i.e. for a 0 to 100 knob, "100-value").
You could also put an invisible control on top of it (a slider with an empty png as its image, or a script panel if you prefer), then in the invisible slider's custom callback, set the visible slider's value to max - current value. Like this:const var visibleSlider = Content.getComponent("visibleSlider"); const var invisibleSlider = Content.getComponent("invisibleSlider"); visibleSlider.set("min", 0.0); visibleSlider.set("max", 100.0); invisibleSlider.set("min", 0.0); invisibleSlider.set("max", 100.0); inline function oninvisibleSliderControl(component, value) { if (value) { visibleSlider.setValue(100-value); } }; Content.getComponent("invisibleSlider").setControlCallback(oninvisibleSliderControl);
-
@ally Thanks so much for this! I'll be playing around with this and report how it goes.
-
@ally The script worked great, and I managed to hook it up to a controller as well. Thanks a lot for your help!
-
@gorangrooves Awesome! No problem :)