gesture-drag
Mouse-drag in Chromium between normalized points to move sliders, drag-and-drop, select text, or reposition UI elements. Set momentum to false to decelerate and stop exactly at the target.
Instructions
Press the left mouse button at a start point, move to an end point, and release — a desktop mouse drag in a Chromium app. All positions are normalized 0.0–1.0 (fractions of the window, not pixels), same coordinate space as gesture-tap and describe, except that a coordinate of exactly 1.0 lands one pixel inside the window edge (gesture-tap maps it to the edge itself). Interpolates mouse-move events at ~60fps over durationMs for a natural drag (a momentum-free drag samples more finely when durationMs is short, so its ease-out has a curve). Use for slider thumbs, drag-and-drop, text selection, or draggable UI elements. Dragging never scrolls content on desktop — use gesture-scroll for lists/pages. Chromium only — on iOS/Android use gesture-swipe. Pass momentum:false for a momentum-free drag that decelerates into the release, so apps that compute a fling from the pointer stream read ~0 velocity and the drag ends where it was aimed instead of flinging past it (a durationMs under ~100ms is too short for the deceleration to suppress the fling entirely). Returns { dragged: true, timestampMs }. Fails if the Chromium CDP session is not reachable for the given device.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| toX | Yes | Release x: normalized 0.0–1.0 (not pixels; same space as tap). | |
| toY | Yes | Release y: normalized 0.0–1.0 (not pixels; same space as tap). | |
| udid | Yes | Target Chromium device id from `list-devices` (chromium-cdp-<port>). | |
| fromX | Yes | Press x: normalized 0.0–1.0 (fraction of window width, not pixels). | |
| fromY | Yes | Press y: normalized 0.0–1.0 (fraction of window height, not pixels). | |
| settle | No | Retired: renamed to `momentum` with the opposite sense. Pass `momentum: false` for what `settle: true` meant; `settle: false` was the default, so drop the key. | |
| momentum | No | Whether the drag releases with momentum; default true (a constant-speed drag). Pass false to decelerate into the release point (ease-out) so an app deriving fling from pointer release velocity (carousels, drag libraries) reads ~0 and applies little to no momentum — use it when the drag must stop where it was aimed rather than fling past. Deceleration needs wall clock: under ~100ms the whole drag fits inside the velocity window a page averages over (tens of ms), so some fling survives, and under ~70ms its extra frames cannot dispatch fast enough to fit durationMs. Keep durationMs at its default when the fling must be fully suppressed. | |
| durationMs | No | Total drag duration in milliseconds (default 300, at most 10000 - the button stays down for exactly this long), interpolated at ~60fps. |