* `from === undefined` → drag from current cursor (training's * left_click_drag with start_coordinate omitted). Inner `finally`: the * button is ALWAYS released even if the move throws — otherwise the * user's left button is stuck-pressed until they physically click. * 50ms sleep
(
from: { x: number; y: number } | undefined,
to: { x: number; y: number },
)
| 642 | * needs a HID-tap round-trip to show up there. |
| 643 | */ |
| 644 | async drag( |
| 645 | from: { x: number; y: number } | undefined, |
| 646 | to: { x: number; y: number }, |
| 647 | ): Promise<void> { |
| 648 | const input = requireComputerUseInput() |
| 649 | if (from !== undefined) { |
| 650 | await moveAndSettle(input, from.x, from.y) |
| 651 | } |
| 652 | await input.mouseButton('left', 'press') |
| 653 | await sleep(MOVE_SETTLE_MS) |
| 654 | try { |
| 655 | await animatedMove(input, to.x, to.y, getMouseAnimationEnabled()) |
| 656 | } finally { |
| 657 | await input.mouseButton('left', 'release') |
| 658 | } |
| 659 | }, |
| 660 | |
| 661 | /** |
| 662 | * Move first, then scroll each axis. Vertical-first — it's the common |
nothing calls this directly
no test coverage detected