Scrolling speed / ammount

Hello,

i have problem with nifty gui mouse scroll. In dropdown i want on every mouse scroll to actually scroll by 1 element, not 120. I cant find solution here.

Thanks :slight_smile:

Nothing? :confused:

It’s not something I’ve ever tried to do. It might be worth looking on the nifty project website (I don’t remember seeing about it in the manual but you could look there too). Check the API for the dropdown as well, there might be something there.

I googled for good amount of time and cant find any solution :frowning:

in logger there is

VIII 27, 2013 9:54:04 ODP. de.lessvoid.nifty.Nifty$NiftyInputConsumerImpl processMouseEvent
INFO: [processMouseEvent] [581, 407, 120, -1, false] processed [true]

which is good for my scrollpanel with list of thumb images with titles
but bad for my dropdown for resolution choose, there may be good to change that 120 to 1 somehow

but i cant resolve how to do it :frowning:

bump

If no-one here knows you can try asking on the nifty project pages or @void256 may see this post although he only checks these forums occasionally.

Well, there is no build-in solution for adjusting scroll speed. I don’t know why you get different scrolling amount by default - might be a system setting that influences this.

Here is the code that makes this conversion:

InputSystemJme.java Line 184

LwjglInputSystem.java Line 103

Both use similar code to take the input event from the system (using lwjgl in both cases I think) and convert it to a value that is then send to Nifty. This code looks in both cases like this:

[java]int mouseWheel = Mouse.getEventDWheel() / 120;
// not sure about that 120 here. works on my system and makes this return 1
// if the wheel is moved the minimal amount.[/java]

The LWJGL API JavaDoc for Mouse.getEventDWheel() doesn’t provide any clues on what unit the value is. Probably because this is system dependent anyway in the end.

So what we need - and what is currently a missing feature - would be to have some kind of mouse scale factor property inside of Nifty so that you actually could adjust the scaling.

It would be helpful if you could create an issue on the github issue tracker for this: https://github.com/void256/nifty-gui/issues and eventually even provide a patch for Nifty that adds that feature too :slight_smile:

1 Like

Hello, im happy you replied :slight_smile:

After a bit googling, i came to this result:

  • 120 is not fixed amount and half games have this bug
  • they say if you scroll slowly, you can get 2 events of 60 and 60, or 54 and 72 and that is not even 120
  • future mice with bigger precision can return smaller values more often

so i think good solution is to reduce this value to 1 (or -1 for opposite direction) by dividing it by absolute itself and introduce some kind of setter which will be absolute event received value by default and multiplies that divided value again, so by default there is no change at all, but we will be able to manipulate it somehow.

i try to create issue and patch when i return home :slight_smile:

1 Like

well its not just about “future” mice, its about different mice in general.

For instance think about how the mousewheel works on a laptop versus a standard desktop mouse, theres also two main kinds of mouse wheels for desktop mice, the kind that “clicks” and the kind that freely slide without clicking increments… Also I believe theres weird input devices like those digital pen devices which can be used as mice, I’m sure they have their own weird way of scrolling…Then on top of that the operating system has a setting to adjust the sensitivity of the mouse wheel…

You have to consider a mousewheel as if it were just another mouse axis really. You need to look at that value and decide if the mousewheel went far enough to constitute the change you want. and then use clamping methods and accumulators to prevent accidental extreme changes. There’s just no easy way of dealing with it, (hence, as you said, why a lot of games get it wrong)

1 Like