@@ -2761,6 +2761,33 @@ export function AppShell({
27612761 } , 1800 ) ;
27622762 }
27632763
2764+ function rotateSelectedSimulator ( direction : "left" | "right" ) {
2765+ if ( ! selectedSimulator ) {
2766+ return ;
2767+ }
2768+ if ( selectedHasFixedOrientation ) {
2769+ return ;
2770+ }
2771+ const androidViewport = isAndroidSimulator ( selectedSimulator ) ;
2772+ const controlType = direction === "left" ? "rotateLeft" : "rotateRight" ;
2773+ const rotationDelta = direction === "left" ? - 1 : 1 ;
2774+ beginZoomAnimation ( ) ;
2775+ if ( sendControl ( selectedSimulator . udid , { type : controlType } ) ) {
2776+ if ( androidViewport ) {
2777+ setRotationQuarterTurns ( 0 ) ;
2778+ window . setTimeout ( ( ) => {
2779+ void refresh ( ) ;
2780+ } , 250 ) ;
2781+ } else {
2782+ setRotationQuarterTurns ( ( current ) =>
2783+ normalizeQuarterTurns ( current + rotationDelta ) ,
2784+ ) ;
2785+ }
2786+ return ;
2787+ }
2788+ setLocalError ( "Simulator control stream disconnected." ) ;
2789+ }
2790+
27642791 async function submitPairing ( event : FormEvent < HTMLFormElement > ) {
27652792 event . preventDefault ( ) ;
27662793 const code = pairingCode . trim ( ) ;
@@ -2889,28 +2916,8 @@ export function AppShell({
28892916 setNewSimulatorOpen ( true ) ;
28902917 } }
28912918 onOpenUrlPrompt = { promptForURL }
2892- onRotateRight = { ( ) => {
2893- if ( ! selectedSimulator ) {
2894- return ;
2895- }
2896- if ( selectedHasFixedOrientation ) {
2897- return ;
2898- }
2899- const androidViewport = isAndroidSimulator ( selectedSimulator ) ;
2900- beginZoomAnimation ( ) ;
2901- if ( sendControl ( selectedSimulator . udid , { type : "rotateRight" } ) ) {
2902- if ( androidViewport ) {
2903- setRotationQuarterTurns ( 0 ) ;
2904- window . setTimeout ( ( ) => {
2905- void refresh ( ) ;
2906- } , 250 ) ;
2907- } else {
2908- setRotationQuarterTurns ( ( current ) => ( current + 1 ) % 4 ) ;
2909- }
2910- return ;
2911- }
2912- setLocalError ( "Simulator control stream disconnected." ) ;
2913- } }
2919+ onRotateLeft = { ( ) => rotateSelectedSimulator ( "left" ) }
2920+ onRotateRight = { ( ) => rotateSelectedSimulator ( "right" ) }
29142921 onToggleRecording = { ( ) => {
29152922 void toggleSimulatorRecording ( ) ;
29162923 } }
0 commit comments