Various fixes

This commit is contained in:
Ilya Laktyushin 2023-07-05 17:26:20 +02:00
parent a480df3ed6
commit 6301b2ba64
5 changed files with 15 additions and 11 deletions

View File

@ -239,15 +239,19 @@ final class CameraDevice {
return
}
self.transaction(device) { device in
let torchMode: AVCaptureDevice.TorchMode
switch flashMode {
case .on:
device.torchMode = .on
torchMode = .on
case .off:
device.torchMode = .off
torchMode = .off
case .auto:
device.torchMode = .auto
torchMode = .auto
@unknown default:
device.torchMode = .off
torchMode = .off
}
if device.isTorchModeSupported(torchMode) {
device.torchMode = torchMode
}
}
}
@ -257,7 +261,7 @@ final class CameraDevice {
return
}
self.transaction(device) { device in
device.videoZoomFactor = max(1.0, min(10.0, zoomLevel))
device.videoZoomFactor = max(device.neutralZoomFactor, min(10.0, device.neutralZoomFactor + zoomLevel))
}
}

View File

@ -749,10 +749,10 @@ final class CaptureControlsComponent: Component {
blobOffset -= self.frame.width / 2.0
var isBanding = false
if location.y < -10.0 {
let fraction = 1.0 + min(8.0, ((abs(location.y) - 10.0) / 60.0))
let fraction = min(8.0, ((abs(location.y) - 10.0) / 60.0))
component.zoomUpdated(fraction)
} else {
component.zoomUpdated(1.0)
component.zoomUpdated(0.0)
}
if location.x < self.frame.width / 2.0 - 30.0 {

View File

@ -77,7 +77,7 @@ func verticesDataForRotation(_ rotation: TextureRotation, rect: CGRect = CGRect(
func textureDimensionsForRotation(texture: MTLTexture, rotation: TextureRotation) -> (width: Int, height: Int) {
switch rotation {
case .rotate90Degrees, .rotate270Degrees:
case .rotate90Degrees, .rotate90DegreesMirrored, .rotate270Degrees:
return (texture.height, texture.width)
default:
return (texture.width, texture.height)

View File

@ -253,7 +253,7 @@ final class VideoInputPass: DefaultRenderPass {
func textureDimensionsForRotation(width: Int, height: Int, rotation: TextureRotation) -> (width: Int, height: Int) {
switch rotation {
case .rotate90Degrees, .rotate270Degrees:
case .rotate90Degrees, .rotate270Degrees, .rotate90DegreesMirrored:
return (height, width)
default:
return (width, height)

View File

@ -1897,12 +1897,12 @@ public final class MediaEditorScreen: ViewController, UIDropInteractionDelegate
if let self, let controller = self.controller, values.gradientColors != nil, controller.previousSavedValues != values {
if !isSavingAvailable && controller.previousSavedValues == nil {
controller.previousSavedValues = values
controller.isSavingAvailable = false
} else {
self.hasAnyChanges = true
controller.isSavingAvailable = true
controller.requestLayout(transition: .animated(duration: 0.25, curve: .easeInOut))
}
controller.requestLayout(transition: .animated(duration: 0.25, curve: .easeInOut))
}
}