import type { CameraOrientation } from 'react-native-vision-camera' /** * Converts a {@linkcode CameraOrientation} to its equivalent clockwise * rotation angle in degrees. * * @internal * @worklet */ export function orientationToDegrees(orientation: CameraOrientation): number { 'worklet' switch (orientation) { case 'up': return 0 case 'down': return 180 case 'left': return 270 case 'right': return 90 } } /** * Normalizes the given rotation in degrees into the range from * `0` to `360` (not including `360`). * * @internal * @worklet */ export function normalizeRotationDegrees(degrees: number): number { 'worklet' const normalized = degrees % 360 if (normalized < 0) { return normalized + 360 } else { return normalized } }