Anleitung
Anleitung zu Bildschirmorientierung
Verwendung von @capgo/capacitor-screen-orientation
Capacitor Bildschirmorientierung-Plugin-Schnittstelle.
Installieren
bun add @capgo/capacitor-screen-orientation
bunx cap sync
Was dieses Plugin bereitstellt
orientation- Aktuelle Bildschirmorientierung abrufen.lock- Bildschirmorientierung auf eine bestimmte Art sperren.unlock- Bildschirmorientierung entsperren.startOrientationTracking- Geräteorientierung mit Bewegungssensoren verfolgen.
Beispielhafte Verwendung
orientation
Aktuelle Bildschirmorientierung abrufen.
import { ScreenOrientation } from '@capgo/capacitor-screen-orientation';
const result = await ScreenOrientation.orientation();
console.log('Current orientation:', result.type);
lock
Die Bildschirmorientierung auf eine bestimmte Art festlegen.
import { ScreenOrientation } from '@capgo/capacitor-screen-orientation';
// Standard lock
await ScreenOrientation.lock({ orientation: 'landscape' });
// Lock with motion tracking on iOS
await ScreenOrientation.lock({
orientation: 'portrait',
bypassOrientationLock: true
});
unlock
Die Bildschirmorientierung freigeben.
import { ScreenOrientation } from '@capgo/capacitor-screen-orientation';
await ScreenOrientation.unlock();
startOrientationTracking
Mit Bewegungssensoren die Geräteorientierung verfolgen.
import { ScreenOrientation } from '@capgo/capacitor-screen-orientation';
await ScreenOrientation.startOrientationTracking({
bypassOrientationLock: true
});
// Listen for changes
ScreenOrientation.addListener('screenOrientationChange', (result) => {
console.log('Orientation changed:', result.type);
});
Vollständige Referenz
- GitHub: https://github.com/Cap-go/capacitor-screen-orientation/
- Dokumentation: /docs/plugins/screen-orientation/
Weitermachen von Using @capgo/capacitor-screen-orientation
Wenn Sie @__CAPGO_KEEP_0__/__CAPGO_KEEP_1__-screen-orientation verwenden Verwenden Sie @capgo/capacitor-screen-orientation um native Medien und Schnittstellenverhalten zu planen, verbinden Sie es mit @__CAPGO_KEEP_0__/__CAPGO_KEEP_1__-screen-orientation @capgo/capacitor-screen-orientation für die Implementierungsdetails in @capgo/capacitor-Bildschirmorientierung, Einstieg für die Implementierungsdetails in Einstieg, Verwendung von @capgo/capacitor-Live-Aktivitäten für die native Fähigkeit in Verwendung von @capgo/capacitor-Live-Aktivitäten, @capgo/capacitor-Live-Aktivitäten für die Implementierungsdetails in @capgo/capacitor-Live-Aktivitäten und Verwendung von @capgo/capacitor-Video-Player für die native Fähigkeit in Verwendung von @capgo/capacitor-Video-Player.