Canvas · the wheel scrolls as scroll boxes do; pans hold at the press

A wheel without a modifier now slides the content by its delta, as
gpui's scroll boxes do; it moved the other way. The wheel reads the
live viewport and skips an end with no delta, and a drag pans from the
press by the pointer's whole way with the viewport held at the press,
so events that land in one frame no longer overwrite each other. Tests:
a plain wheel moves the content up with it; three wheels and an empty
end add up, and four moves pan their sum; a small frame fits at a zoom
of one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ZacharyZhang-NYandClaude Opus 5.5 committed 2026-09-27 07:15:01 -04:00
1 parent 2c099ceffb
commit ea99d30e3b
4 files changed
+73 -15

No files matched your search

+3
View File
@@ -159,6 +159,9 @@ mod tests {
let view = Viewport::fitting(Frame::new(0.0, 0.0, 800.0, 400.0), (440.0, 440.0), 20.0);
assert_eq!(view.zoom, 0.5);
assert_eq!(view.to_view((400.0, 200.0)), (220.0, 220.0));
let small = Viewport::fitting(Frame::new(0.0, 0.0, 100.0, 50.0), (440.0, 440.0), 20.0);
assert_eq!(small.zoom, 1.0, "no nearer than a zoom of one");
assert_eq!(small.to_view((50.0, 25.0)), (220.0, 220.0));
}
#[test]