(direction: "left" | "right")
| 2802 | } |
| 2803 | |
| 2804 | function rotateSelectedSimulator(direction: "left" | "right") { |
| 2805 | if (!selectedSimulator) { |
| 2806 | return; |
| 2807 | } |
| 2808 | if (selectedHasFixedOrientation) { |
| 2809 | return; |
| 2810 | } |
| 2811 | const androidViewport = isAndroidSimulator(selectedSimulator); |
| 2812 | const controlType = direction === "left" ? "rotateLeft" : "rotateRight"; |
| 2813 | const rotationDelta = direction === "left" ? -1 : 1; |
| 2814 | beginZoomAnimation(); |
| 2815 | if (sendControl(selectedSimulator.udid, { type: controlType })) { |
| 2816 | if (androidViewport) { |
| 2817 | setRotationQuarterTurns(0); |
| 2818 | window.setTimeout(() => { |
| 2819 | void refresh(); |
| 2820 | }, 250); |
| 2821 | } else { |
| 2822 | setRotationQuarterTurns((current) => |
| 2823 | normalizeQuarterTurns(current + rotationDelta), |
| 2824 | ); |
| 2825 | } |
| 2826 | return; |
| 2827 | } |
| 2828 | setLocalError("Simulator control stream disconnected."); |
| 2829 | } |
| 2830 | |
| 2831 | async function submitPairing(event: FormEvent<HTMLFormElement>) { |
| 2832 | event.preventDefault(); |
no test coverage detected