MCPcopy Index your code
hub / github.com/callstack/agent-device / handlePanCommand

Function handlePanCommand

src/core/dispatch-interactions.ts:685–712  ·  view source on GitHub ↗
(
  interactor: Interactor,
  positionals: string[],
)

Source from the content-addressed store, hash-verified

683}
684
685export 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
714export async function handleFlingCommand(
715 interactor: Interactor,

Callers 2

dispatch.tsFile · 0.90

Calls 4

requireIntInRangeFunction · 0.90
successTextFunction · 0.90
isFiniteMethod · 0.80
panMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…