HISE Logo Forum
    • Categories
    • Register
    • Login

    Invert mouse wheel response over a slider

    Scheduled Pinned Locked Moved General Questions
    7 Posts 2 Posters 300 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • gorangroovesG
      gorangrooves
      last edited by

      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?

      Goran Rista
      https://gorangrooves.com

      Handy Drums and Handy Grooves
      https://library.gorangrooves.com

      1 Reply Last reply Reply Quote 0
      • A
        ally
        last edited by

        Do you want this behavior only for the mouse wheel? So clicking and dragging moves the slider values normally?

        gorangroovesG 1 Reply Last reply Reply Quote 0
        • gorangroovesG
          gorangrooves @ally
          last edited by

          @ally Actually, all of it could be reversed, click+drag, and scroll wheel.

          Goran Rista
          https://gorangrooves.com

          Handy Drums and Handy Grooves
          https://library.gorangrooves.com

          A 1 Reply Last reply Reply Quote 0
          • A
            ally @gorangrooves
            last edited by

            @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);
            
            
            gorangroovesG 1 Reply Last reply Reply Quote 1
            • gorangroovesG
              gorangrooves @ally
              last edited by

              @ally Thanks so much for this! I'll be playing around with this and report how it goes.

              Goran Rista
              https://gorangrooves.com

              Handy Drums and Handy Grooves
              https://library.gorangrooves.com

              gorangroovesG 1 Reply Last reply Reply Quote 0
              • gorangroovesG
                gorangrooves @gorangrooves
                last edited by

                @ally The script worked great, and I managed to hook it up to a controller as well. Thanks a lot for your help!

                Goran Rista
                https://gorangrooves.com

                Handy Drums and Handy Grooves
                https://library.gorangrooves.com

                A 1 Reply Last reply Reply Quote 0
                • A
                  ally @gorangrooves
                  last edited by

                  @gorangrooves Awesome! No problem :)

                  1 Reply Last reply Reply Quote 0
                  • First post
                    Last post

                  52

                  Online

                  1.7k

                  Users

                  11.7k

                  Topics

                  101.9k

                  Posts