본문으로 건너뛰기
플러그인으로 돌아가기
@capgo/capacitor-모니터 방향
튜토리얼
@capgo/capacitor-모니터 방향

모니터 방향

모니터 방향 플러그인이 지원하는 방향 잠금 우회

설명서

스크린 방향성 튜토리얼

장치에서 테스트

Capgo 앱을 다운로드하고 QR코드 code를 스캔하세요.

화면 방향 플러그인 미리보기 QR code

Using @capgo/capacitor-screen-orientation

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

전체 참조

Using @capgo/capacitor-screen-orientation

Capacitor Screen Orientation을 사용 중이라면 Using @capgo/capacitor-screen-orientation Capacitor Screen Orientation을 사용하여 @capgo/capacitor-screen-orientation Capacitor @capgo/capacitor-screen-orientation Getting Started Capacitor @__CAPGO_KEEP_0__/__CAPGO_KEEP_1__-screen-orientation Capacitor @capgo/capacitor-live-activities Capacitor @capgo/capacitor-live-activities Capacitor @capgo/capacitor-live-activities Capacitor @capgo/capacitor-video-player Capacitor @capgo/capacitor-video-player for the native capability in Using @capgo/capacitor-video-player.