( xInput: string | undefined, yInput: string | undefined, )
| 993 | } |
| 994 | |
| 995 | function 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 | |
| 1012 | function parseGestureDirection(input: string | undefined, field: string): ScrollDirection { |
| 1013 | return parseStringMember(SCROLL_DIRECTIONS, input, { |
no test coverage detected