Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit b3d1a27

Browse files
committed
Use 120 wheelDelta to identify mouse-accelerated events instead of 240
Apparently some high-precision mice use 120 instead of 240 as the wheelDelta per tick.
1 parent 14c9e4c commit b3d1a27

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/web_ui/lib/src/engine/pointer_binding.dart

+2-2
Original file line numberDiff line numberDiff line change
@@ -369,11 +369,11 @@ mixin _WheelEventListenerMixin on _BaseAdapter {
369369
return false;
370370
}
371371
if (((event.deltaX % 120 == 0) && (event.deltaY % 120 == 0)) ||
372-
(((event.wheelDeltaX ?? 1) % 240 == 0) && ((event.wheelDeltaY ?? 1) % 240) == 0)) {
372+
(((event.wheelDeltaX ?? 1) % 120 == 0) && ((event.wheelDeltaY ?? 1) % 120) == 0)) {
373373
// While not in any formal web standard, `blink` and `webkit` browsers use
374374
// a delta of 120 to represent one mouse wheel turn. If both dimensions of
375375
// the delta are divisible by 120, this event is probably from a mouse.
376-
// Checking if wheelDeltaX and wheelDeltaY are both divisible by 240
376+
// Checking if wheelDeltaX and wheelDeltaY are both divisible by 120
377377
// catches any macOS accelerated mouse wheel deltas which by random chance
378378
// are not caught by _isAcceleratedMouseWheelDelta.
379379
final num deltaXChange = (event.deltaX - (lastEvent?.deltaX ?? 0)).abs();

0 commit comments

Comments
 (0)