- From: Ziad El Khoury Hanna <notifications@github.com>
- Date: Mon, 15 Jul 2024 03:39:32 -0700
- To: w3c/uievents <uievents@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Monday, 15 July 2024 10:39:36 UTC
After conducting a [survey on wheel deltas](https://docs.google.com/spreadsheets/d/1YBTbMSq12_6jmXGm7GJi11RCatYTGk_WkOtfBptgqKI), I found the deprecated `wheelDelta*` properties are generally more consistent across platforms and browsers. Motivated by these findings we updated the web app mentioned above to use `wheelDelta*` properties, except on Apple systems (macOS, iOS, iPadOS, ...) for which we still use `delta*` properties. Example: ```js function getWheelDelta(event) { if (isApple) { // Note that deltaMode MUST be accessed BEFORE delta* in order to get // non-pixel values in Firefox. // See https://github.com/w3c/uievents/issues/181 switch (event.deltaMode) { default: case event.DOM_DELTA_PIXEL: return [event.deltaX / 120, -event.deltaY / 120]; case event.DOM_DELTA_LINE: case event.DOM_DELTA_PAGE: // Discard the delta value, just take the sign return [Math.sign(event.deltaX), Math.sign(-event.deltaY)]; } } else { return [-event.wheelDeltaX / 120, event.wheelDeltaY / 120]; } } ``` -- Reply to this email directly or view it on GitHub: https://github.com/w3c/uievents/issues/181#issuecomment-2228196131 You are receiving this because you are subscribed to this thread. Message ID: <w3c/uievents/issues/181/2228196131@github.com>
Received on Monday, 15 July 2024 10:39:36 UTC