( device: DeviceInfo, interactor: Interactor, positionals: string[], context: DispatchContext | undefined, )
| 865 | } |
| 866 | |
| 867 | export async function handlePinchCommand( |
| 868 | device: DeviceInfo, |
| 869 | interactor: Interactor, |
| 870 | positionals: string[], |
| 871 | context: DispatchContext | undefined, |
| 872 | ): Promise<Record<string, unknown>> { |
| 873 | // Cross-platform TV-target gate (also rejects Android TV, which shares target: 'tv'); |
| 874 | // NOT narrowed to the tvOS Apple-OS leaf (isTvOsDevice) so Android-TV behavior is unchanged. |
| 875 | if (device.target === 'tv') { |
| 876 | throw new AppError('UNSUPPORTED_OPERATION', 'gesture pinch is not supported on tvOS'); |
| 877 | } |
| 878 | if (isMacOs(device) && context?.surface && context.surface !== 'app') { |
| 879 | throw new AppError( |
| 880 | 'UNSUPPORTED_OPERATION', |
| 881 | 'gesture pinch is only supported in macOS app sessions. Re-open the target app without --surface desktop|menubar|frontmost-app first.', |
| 882 | ); |
| 883 | } |
| 884 | const scale = Number(positionals[0]); |
| 885 | const x = positionals[1] ? Number(positionals[1]) : undefined; |
| 886 | const y = positionals[2] ? Number(positionals[2]) : undefined; |
| 887 | if (Number.isNaN(scale) || scale <= 0) { |
| 888 | throw new AppError('INVALID_ARGS', 'gesture pinch requires scale > 0'); |
| 889 | } |
| 890 | const interactionResult = await interactor.pinch(scale, x, y); |
| 891 | return { scale, x, y, ...interactionResult, ...successText(`Pinched to scale ${scale}`) }; |
| 892 | } |
| 893 | |
| 894 | export async function handleRotateGestureCommand( |
| 895 | device: DeviceInfo, |
no test coverage detected