native icon indicating copy to clipboard operation
native copied to clipboard

First-class trackpad pinch input for GPU-surface apps

Open ctate opened this issue 4 months ago • 1 comments

Fixes the reported gap: AppKit received magnify gestures but the GPU-surface event API dropped them before applications could respond — timeline and canvas apps had no pinch input at all.

  • Platform-neutral vocabulary: pinch_begin / pinch_change / pinch_end join GpuSurfaceInputKind, with a scale: f32 field carrying the per-change magnification delta (cumulative zoom = product of 1+delta; deltas emit uncoalesced because summed coalesced deltas would drift the product) and the centroid on the existing x/y. The kind family stays open for rotate/smart-zoom; Windows precision-touchpad and GTK GestureZoom are staged honestly as follow-up sources (nothing panics — the kinds simply never arrive there yet).
  • macOS host: magnifyWithEvent: translates phases (Cancelled folds into pinch_end — unlike pointer-cancel there is no uncommitted transient to roll back; a Changed with no active gesture opens with a synthesized begin).
  • Delivery is an app-level channel, matching the frame/key pattern: Zig cores get Options.on_pinch; TypeScript cores export pinchMsg(pinch): Msg | null. Zoom is an app concern — pinch deliberately bypasses the widget pipeline, and no registry codes were consumed. One transpiler fix rode along: the pinch record's fields are classed as boundary floats so scale === 0 comparisons can't int-claim the slot and round zoom products.
  • widget-pinch automation verb (begin + one exact-product change + end, journaled as real input) so tests and users drive pinch without a trackpad; journal v5 carries the scale field and automation protocol v7 the verb — both stated as deliberate breaks in the changelog.
  • Record→replay pins binary-exact zoom products (1.25² = 1.5625) for raw and verb-driven pinches in both tiers; every behavior test sabotage-verified.

Suites: full battery, validate, tooling, examples, ts-core e2e, docs check, packages/core npm suite (210/210) — all green.

ctate avatar Jul 17 '26 06:07 ctate

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
native-sdk Ready Ready Preview, Comment Jul 17, 2026 5:12pm

vercel[bot] avatar Jul 17 '26 06:07 vercel[bot]

@ctate thanks for getting this merged in! I've got a neat little video editor I've been porting from WebCodecs + WebGPU to fully native on MacOS w/ Metal and this was another thing I needed.

jhodges10 avatar Jul 20 '26 19:07 jhodges10