fix: Move minExposure/maxExposure from format into device (#2211)

* fix: Move `minExposure`/`maxExposure` into `device`

* Update docs

* chore: Remove unneeded dependency

* chore: Update code
This commit is contained in:
Marc Rousavy
2023-11-24 18:20:56 +01:00
committed by GitHub
parent bb3a42e6bc
commit cad5240420
8 changed files with 25 additions and 36 deletions

View File

@@ -187,14 +187,14 @@ extension CameraSession {
ReactLogger.log(level: .info, message: "Configuring Format (\(targetFormat))...")
let currentFormat = CameraDeviceFormat(fromFormat: device.activeFormat, forDevice: device)
let currentFormat = CameraDeviceFormat(fromFormat: device.activeFormat)
if currentFormat == targetFormat {
ReactLogger.log(level: .info, message: "Already selected active format, no need to configure.")
return
}
// Find matching format (JS Dictionary -> strongly typed Swift class)
let format = device.formats.first { targetFormat.isEqualTo(format: $0, device: device) }
let format = device.formats.first { targetFormat.isEqualTo(format: $0) }
guard let format else {
throw CameraError.format(.invalidFormat)
}
@@ -295,7 +295,7 @@ extension CameraSession {
return
}
let clamped = max(min(exposure, device.maxExposureTargetBias), device.minExposureTargetBias)
let clamped = min(max(exposure, device.minExposureTargetBias), device.maxExposureTargetBias)
device.setExposureTargetBias(clamped)
}