fix: Check torch only if needed (#2215)

This commit is contained in:
Marc Rousavy 2023-12-14 10:54:19 +01:00 committed by GitHub
parent 3a627c7262
commit bd5c9675b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -115,7 +115,8 @@ class CameraConfiguration {
// side-props (depends on format)
sidePropsChanged = formatChanged || left?.fps != right.fps || left?.enableLowLightBoost != right.enableLowLightBoost
// torch (depends on isActive)
torchChanged = left?.isActive != right.isActive || left?.torch != right.torch
let wasInactiveAndNeedsToEnableTorchAgain = left?.isActive == false && right.isActive == true && right.torch == .on
torchChanged = inputChanged || wasInactiveAndNeedsToEnableTorchAgain || left?.torch != right.torch
// zoom (depends on format)
zoomChanged = formatChanged || left?.zoom != right.zoom
// exposure (depends on device)