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

Function parseOptionalGestureCenter

src/core/dispatch-interactions.ts:995–1010  ·  view source on GitHub ↗
(
  xInput: string | undefined,
  yInput: string | undefined,
)

Source from the content-addressed store, hash-verified

993}
994
995function parseOptionalGestureCenter(
996 xInput: string | undefined,
997 yInput: string | undefined,
998): Pick<RotateGestureParams, 'x' | 'y'> {
999 if (xInput === undefined && yInput === undefined) return {};
1000 if (xInput === undefined || yInput === undefined) {
1001 throw new AppError('INVALID_ARGS', 'gesture rotate center requires both x and y');
1002 }
1003
1004 const x = Number(xInput);
1005 const y = Number(yInput);
1006 if (!Number.isFinite(x) || !Number.isFinite(y)) {
1007 throw new AppError('INVALID_ARGS', 'gesture rotate center requires finite x and y');
1008 }
1009 return { x, y };
1010}
1011
1012function parseGestureDirection(input: string | undefined, field: string): ScrollDirection {
1013 return parseStringMember(SCROLL_DIRECTIONS, input, {

Callers 1

parseRotateGestureParamsFunction · 0.85

Calls 1

isFiniteMethod · 0.80

Tested by

no test coverage detected