[#31] Gestures: jitter filter, edge rubber-band, pinch-to-zoom - #98
Merged
Conversation
GestureFilter passes precise deltas bit-exact (1:1 sync, glide cancel from displayed offset) and quantizes classic-wheel jitter to whole points with lossless residue. Bound residual becomes a capped, decaying EdgeSpring overshoot translated per-frame. Pinch tiers into x1.25 steps (smart double-tap toggles 100/150%). Momentum phases flow as before. Closes #31.
gregoreesmaa
force-pushed
the
issue-31-gestures
branch
from
September 8, 2026 06:15
bf84c1c to
79f36c3
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #31. GestureFilter (viewport.zig, first in onScroll): precise trackpad/Magic Mouse deltas pass bit-exact so 1:1 sync and glide-cancel-from-displayed-offset are preserved; classic non-precise jitter accumulates fractional residue and emits whole points (no shimmer, no lost motion; absorbed zeros reset the scroll lock like a lifted gesture). Clamped-away scroll at a document bound becomes a capped (48px) EdgeSpring overshoot, translated per frame in drawRect, decaying with full redraws until the timer parks at exactly zero. Pinch: magnifyWithEvent forwards deltas (0.0 skipped), Zig PinchState tiers them into x1.25 zoom steps with residue; smartMagnifyWithEvent double-tap toggles 100%/150% via reserved 0.0. Momentum/inertia phases flow through the existing path unchanged.
Evidence: zig build test -Doptimize=ReleaseFast --summary all green (144/144; 4 new: filter quantize/passthrough, mid-glide cancel, spring cap/decay/settle, pinch tiers). Ship binary 176472 B (<180 KiB). Screenshots regenerated, no visual diff.
Overlap note: pinch zoom here is standalone (17.0 x factor); #30 (PR #97) owns the class-aware TextScale — merge keeps #30's scale and routes these tier steps through it.
Verification limits: AppKit gesture/rubber-band paths compile in both binaries but need windowed trackpad testing; behavior pinned via GestureFilter/EdgeSpring/PinchState contract tests.