( interactor: Interactor, positionals: string[], )
| 683 | } |
| 684 | |
| 685 | export async function handlePanCommand( |
| 686 | interactor: Interactor, |
| 687 | positionals: string[], |
| 688 | ): Promise<Record<string, unknown>> { |
| 689 | const x = Number(positionals[0]); |
| 690 | const y = Number(positionals[1]); |
| 691 | const dx = Number(positionals[2]); |
| 692 | const dy = Number(positionals[3]); |
| 693 | if ([x, y, dx, dy].some((value) => !Number.isFinite(value))) { |
| 694 | throw new AppError('INVALID_ARGS', 'gesture pan requires x y dx dy [durationMs]'); |
| 695 | } |
| 696 | const requestedDurationMs = positionals[4] ? Number(positionals[4]) : 500; |
| 697 | const durationMs = requireIntInRange(requestedDurationMs, 'durationMs', 16, 10_000); |
| 698 | const x2 = x + dx; |
| 699 | const y2 = y + dy; |
| 700 | const interactionResult = await interactor.pan(x, y, x2, y2, durationMs); |
| 701 | return { |
| 702 | x, |
| 703 | y, |
| 704 | dx, |
| 705 | dy, |
| 706 | x2, |
| 707 | y2, |
| 708 | durationMs, |
| 709 | ...(interactionResult ?? {}), |
| 710 | ...successText(`Panned (${x}, ${y}) by (${dx}, ${dy})`), |
| 711 | }; |
| 712 | } |
| 713 | |
| 714 | export async function handleFlingCommand( |
| 715 | interactor: Interactor, |
no test coverage detected
searching dependent graphs…