# gpui: Lock touch scrolling to the dominant axis \(\#63553\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/5e28272c1407ced4bae4a90deaea25352a1fbc96)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: 5e28272c1407ced4bae4a90deaea25352a1fbc96

Requested commit: 5e28272c1407ced4bae4a90deaea25352a1fbc96

Commit: 5e28272c1407ced4bae4a90deaea25352a1fbc96

Tree: ce1925f498b108a7ec5ec0198320240e2dd777a6

Author: Jakub Konka

Committer: GitHub

## Message

```
gpui: Lock touch scrolling to the dominant axis (#63553)

Touch pans currently preserve small amounts of movement on both axes,
including in the synthetic momentum generated after release. In a nested
scrolling layout, a mostly vertical fling that starts over a
horizontally scrollable child can therefore move the child horizontally
while its ancestor moves vertically.

This locks each touch pan to the dominant axis of its accumulated
movement when it crosses the touch-slop threshold. Initial movement,
predicted updates, release correction, velocity, and momentum are
projected onto that axis, so every scroll listener sees the same
one-dimensional gesture for its full lifetime.

The existing trackpad and wheel behavior remains unchanged; the new rule
is applied by the portable raw-touch recognizer before it emits semantic
scroll events.

Testing:

- `cargo nextest run -p gpui --lib gestures::tests`
- `cargo fmt --all -- --check`
- `./script/clippy -p gpui`
- Built Delta Web for `wasm32-unknown-unknown` with this GPUI worktree
and reached a successful Trunk release build

Release Notes:

- N/A
```

## Parents

- [f8c278352fcc4289de66db79b599c98c1a57d351](https://git.cafe/gitcafe/zed/commit/f8c278352fcc4289de66db79b599c98c1a57d351?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/5e28272c1407ced4bae4a90deaea25352a1fbc96?format=markdown)
