MCPcopy Create free account
hub / github.com/NativeScript/SimDeck / rotateSelectedSimulator

Function rotateSelectedSimulator

packages/client/src/app/AppShell.tsx:2804–2829  ·  view source on GitHub ↗
(direction: "left" | "right")

Source from the content-addressed store, hash-verified

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();

Callers 1

AppShellFunction · 0.85

Calls 6

normalizeQuarterTurnsFunction · 0.90
beginZoomAnimationFunction · 0.85
sendControlFunction · 0.85
setTimeoutMethod · 0.80
isAndroidSimulatorFunction · 0.70
refreshFunction · 0.50

Tested by

no test coverage detected