Skip to content

fix(tao): dispatch recognized trackpad pinch as Compose Scale events (#660) - #662

Draft
kdroidFilter wants to merge 1 commit into
nucleus-2.6from
fix/660-tao-trackpad-scale-events
Draft

fix(tao): dispatch recognized trackpad pinch as Compose Scale events (#660)#662
kdroidFilter wants to merge 1 commit into
nucleus-2.6from
fix/660-tao-trackpad-scale-events

Conversation

@kdroidFilter

Copy link
Copy Markdown
Collaborator

Closes #660.

Platform-recognized pinch (AppKit magnify, GDK pinch, Windows Ctrl+wheel) was replayed as two synthetic PointerType.Touch contacts 120 px either side of the cursor. That sent an already-recognized gesture through Compose touch recognition again: span/slop delay, release momentum, and contacts that could miss the target or hit neighbouring chrome (the MapLibre edge interruptions).

What changed

  • Magnify is now ScaleStart / ScaleChange / ScaleEnd at the cursor, with scaleGestureFactor as the per-event ratio (1 + NSEvent.magnification, GDK's ratio, or the Windows/Linux Ctrl+wheel step).
  • Shared dispatchTrackpadScale + TaoTrackpadScaleSession (same shape as the Tao: distinguish trackpad panning from wheel scrolling in Compose #654 pan path).
  • Rotation still synthesises two Touch pointers — Compose has no rotation event.
  • ZoomTab and Trackpad Lab consume Scale events; the inspector logs them.

Measured on the offscreen Tao scene (macOS, same ComposeScene as the host):

Two-touch synthesis Scale events
Pointers 2 Touch, ±120 px, span 240 px 1 Mouse at the cursor
Map edge (cursor 10 px inside) one contact in the map, one in chrome map only
+1 % pinch 0 detectTransformGestures callbacks (zoomMotion 1.2 px vs ~18 px slop) transformable zoom = 1.01 immediately
Delay 13 × 1 % steps (~13 %) before zoom none

detectTransformGestures does not see Scale events (Compose 1.12). Apps that pinch via that API need Modifier.transformable or a PointerEventType.Scale* listener — MapLibre already does.

Test plan

  • :decorated-window-tao:testTaoSceneTrackpadScaleTest, TaoTrackpadScaleSessionTest
  • :examples:shared:compileKotlin / :examples:nucleus-demo:compileKotlin
  • ktlint + detekt on the touched modules
  • Trackpad Lab: pinch logs ScaleStart / ScaleChange / ScaleEnd, map canvas zooms, two-finger swipe still pans
  • ZoomTab: pinch zooms, two-finger rotate still rotates

…660)

Forward platform pinch (AppKit magnify, GDK pinch, Windows Ctrl+wheel) as
ScaleStart / ScaleChange / ScaleEnd at the cursor instead of two synthetic
Touch contacts 120 px off it. Rotation stays two-finger Touch; Compose has
no rotation event.
@kdroidFilter
kdroidFilter marked this pull request as draft September 7, 2026 11:38
@sargunv

sargunv commented Sep 7, 2026

Copy link
Copy Markdown

confirmed this works well with maplibre compose

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.

2 participants