Mouse wheel

What does scrolling actually mean? It depends on the platform and on the mouse.

See druid#68 for the code that implements this. There are some additional links and comments in the review.


W3C's WheelEvent specifies it as the “expected amount the page will scroll”

On my Windows machine, “away from user” is a negative number. At lines = 3 (in preferences), one bump of the physical mouse wheel is 200. Rightward motion on the trackpad is a positive number.

On my Mac, when “Scroll direction: Natural” is checked, “away from user” is a positive number, and rightward motion on the trackpad is a negative number. Both flip when it is unchecked. The magnitude is dependent on the rate of scrolling (i.e. this is adaptively scaled).

See significant discussion in Chromium issue 227454, including having got the polarity wrong.


The doc for WM_MOUSEWHEEL message specifies that rolling away from the user is a positive number. Rightward motion on the trackpad is a positive number.

One bump of the external scroll wheel is 120, consistent with documentation.

The sensitivity setting should be read from SystemParametersInfo.


The doc for NSEvent scrollingDeltaY is not helpful.

The value of scrollingDeltaX and scrollingDeltaY is the negative of the web value. Note also, hasPreciseScrollingDeltas is true for trackpad and false for external mice.

The value of scrollingDeltaX and scrollingDeltaY inverts when the “Scroll direction: Natural” setting is toggled, i.e .the setting is applied before the event is given to the app.

External mouse wheel vs trackpad

An external mouse wheel delta is traditionally multiplied by 32, while a touchpad delta is not. Here's the corresponding Makepad version. Also note that Winit keeps the distinction (using LineDelta for an ext mouse wheel, PixelDelta for the trackpad).