Skip to content

Fix scrolling - #71

Open
tobiasbischoff wants to merge 1 commit into
omacom:masterfrom
tobiasbischoff:scroll-like-a-webpage
Open

tobiasbischoff wants to merge 1 commit into
omacom:masterfrom
tobiasbischoff:scroll-like-a-webpage

Conversation

@tobiasbischoff

@tobiasbischoff tobiasbischoff commented Sep 17, 2026

Copy link
Copy Markdown

Problem

Mouse wheel and touchpad scrolling both felt off.

The wheel already had a custom animation, but the Impulse curve dumped most of each notch in the first frames and contentY snapped to a device pixel on every frame. A notch jumped, then crawled.

Two-finger scrolling tracked 1:1 and stopped dead on lift: no acceleration on a flick, no inertial coast.

On Wayland, Qt reports every pointer's scroll as a touchpad, so mouse and fingers have to be told apart by event shape. Mixing those paths made notches take the pixel path (tiny motion) or pixel gestures take the notch path (120px jumps).

How

Two paths, split the way Wayland requires:

  • Mouse (angleDelta only): ease-out toward a running 120px-per-notch target over ~300ms, without per-frame snapping. Consecutive notches retarget the same animation so a spin stays one motion.
  • Touchpad (pixelDelta): 1:1 at low speed, gain ramping toward ~2.25× on a flick, then an exponential fling after lift (τ = 460ms). A new contact after a pause catches the coast; continuing the same swipe does not.

Flickable still does not see these events. Letting it handle pixel scrolling rebounds to the drag origin.

Verification

  • bin/test: 12 passed, 0 failed.
  • Built build/omawrite and exercised mouse wheel and two-finger scrolling on a long document (Omarchy / Hyprland).

Flickable still turns wheel notches into a tiny font-sized flick, and
the previous Impulse curve dumped most of each notch in the first
frames, so the mouse felt jumpy. Touchpad pixel events were applied
one-to-one with no coast, then died on lift, which is nothing like a
Mac trackpad or Chrome.

Keep the two-path split Wayland forces (pixelDelta is a touchpad,
angle-only notches are a mouse). Mouse notches now ease-out over
~300ms without snapping every frame. Touchpad tracking stays 1:1 at
low speed, gains up to ~2.25× on a flick, and continues with an
exponential fling after lift. Two fingers back after a pause catch
the coast; continuing the same swipe does not.
@tobiasbischoff tobiasbischoff changed the title Scroll the document like a webpage in Chrome Fix scrolling Sep 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant