Skip to content

v2.6.0

Choose a tag to compare

@igorzheludkov igorzheludkov released this 04 Aug 17:48
· 169 commits to main since this release

pinch — real two-finger multi-touch (Android emulator)

A new pinch tool that sends two genuine kernel touch contacts through the Android emulator's gRPC bridge using the Linux multi-touch protocol. Because it works below the app rather than through React Native, it zooms maps, image galleries, WebViews, and native views alike.

  • direction: "out" zooms in, "in" zooms out
  • x/y set the focal point in the shared screenshot-pixel space — pass coordinates straight from get_screen_state or a screenshot, no conversion
  • scale is the finger-separation ratio; ratios too large for one gesture chain automatically
  • angle picks the finger axis; span shrinks the gesture's footprint without changing the zoom ratio
  • Returns verification.meaningful just like swipe

Android emulators only — iOS is in progress. Physical Android devices have no such bridge, and iOS needs a multi-touch HID helper that no released idb ships. Both return an explicit error rather than a partial result. pinch never fakes a zoom by calling app code: a success means real fingers moved.

Added with zero new dependenciesnode:http2 plus a hand-written protobuf encoder whose output is byte-identical to the official gRPC serializer.

If direction: "in" appears to do nothing

Lower span (try 0.5). A pinch-in starts with the fingers far apart, so at the default span they land at the screen extremes, where a top bar or bottom sheet can take the gesture before the zoomable surface sees it.

Fixed

  • swipe direction shorthand was off-target. captureScreenshot returns device dimensions from before the downscale applied to fit the API limit, but the shorthand treated them as screenshot pixels and scaled them again. On a 1080x2424 emulator, swipe({direction:"up"}) reported swiping from (540, 1612) while actually swiping from (654, 1954) — off-centre horizontally, lower than intended, with distance inflated by the same factor. Masked when verify:false, and on devices small enough to need no downscale.