@capgo/capacitor-스크린-방향 사용하기
Capacitor 스크린 방향 플러그인 인터페이스.
설치
bun add @capgo/capacitor-screen-orientation
bunx cap sync
이 플러그인이 제공하는 것
orientation- 현재 스크린 방향 가져오기.lock- 특정 방향으로 스크린 방향 잠금.unlock- 스크린 방향 잠금 해제.startOrientationTracking- 장치 방향 추적 시작.
예시 사용
orientation
현재 스크린 방향 가져오기.
import { ScreenOrientation } from '@capgo/capacitor-screen-orientation';
const result = await ScreenOrientation.orientation();
console.log('Current orientation:', result.type);
lock
화면 방향을 특정 유형으로 고정하세요.
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
화면 방향을 해제하세요.
import { ScreenOrientation } from '@capgo/capacitor-screen-orientation';
await ScreenOrientation.unlock();
startOrientationTracking
운동 센서를 사용하여 장치 방향을 추적하세요.
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);
});
전체 참조
- GitHub https://github.com/Cap-go/capacitor-화면-방향/
- 문서: /docs/plugins/화면-방향/
Using @capgo/capacitor-화면-방향
이 기능을 사용하는 경우 Using @capgo/capacitor-화면-방향 자연/native 미디어 및 인터페이스 동작을 계획하려면 @capgo/capacitor-화면-방향 implementation detail in @capgo/capacitor-screen-orientation에 대한 Getting Started implementation detail in Getting Started에 대한 Using @capgo/capacitor-live-activities native capability in Using @capgo/capacitor-live-activities에 대한 @capgo/capacitor-live-activities implementation detail in @capgo/capacitor-live-activities 및 Using @capgo/capacitor-video-player native capability in Using @capgo/capacitor-video-player에 대한