What is the scaling of MouseWheelDetails::deltaY?


#1

Hi,

Is the scale of MouseWheelDetails::deltaY specified somewhere?

On Windows a single click from an old-school mousewheel the Windows API will give you a value of ±120 (the value of WHEEL_DELTA, Raymond Chen gives some background here), which is in JUCE scaled to the somewhat odd number 120/256. I have no idea about the other platforms.

But the API can also return multiples of 120 if clicks happen in rapid succession. I want to know how many clicks happened. Of course I can just use wheel.deltaY * 256.0 / 120.0 but is there a more standard way to figure out the amount of clicks?


#2

So actually it depends:

Windows → 120/256 — (see juce_win32_Windowing.cpp:1868)
Linux → 50/256 — see juce_linux_Windowing.cpp:2213)


#3

The numbers come from a series of tests we did with different mice and OSes. The goal was that a document should be scrolled by roughly the same amount across all OSes when the scroll wheel/finger gesture was moved by the same amount.


#4

OK I see, thanks

(I missed another factor 0.5f in the Windows code. So the numbers are resp. 60/256 and 50/256, which is indeed pretty close.)