@@ -1636,7 +1636,7 @@ public class CameraPreview: CAPPlugin, CAPBridgedPlugin, CLLocationManagerDelega
16361636 // First, convert from UI/display zoom to native zoom using the iOS 18 multiplier
16371637 let displayMultiplier = self . cameraController. getDisplayZoomMultiplier ( )
16381638 if displayMultiplier != 1.0 {
1639- level = level / displayMultiplier
1639+ level /= displayMultiplier
16401640 }
16411641
16421642 let ramp = call. getBool ( " ramp " ) ?? true
@@ -2017,11 +2017,11 @@ public class CameraPreview: CAPPlugin, CAPBridgedPlugin, CLLocationManagerDelega
20172017
20182018 if currentRatio > ratio {
20192019 let newWidth = frame. height * ratio
2020- frame. origin. x = frame . origin . x + ( frame. width - newWidth) / 2
2020+ frame. origin. x += ( frame. width - newWidth) / 2
20212021 frame. size. width = newWidth
20222022 } else {
20232023 let newHeight = frame. width / ratio
2024- frame. origin. y = frame . origin . y + ( frame. height - newHeight) / 2
2024+ frame. origin. y += ( frame. height - newHeight) / 2
20252025 frame. size. height = newHeight
20262026 }
20272027 }
@@ -2074,14 +2074,14 @@ public class CameraPreview: CAPPlugin, CAPBridgedPlugin, CLLocationManagerDelega
20742074 }
20752075
20762076 // Always set to -1 for auto-centering if not explicitly provided
2077- if let x = call. getInt ( " x " ) {
2078- self . posX = CGFloat ( x )
2077+ if let xValue = call. getInt ( " x " ) {
2078+ self . posX = CGFloat ( xValue )
20792079 } else {
20802080 self . posX = - 1 // Auto-center if X not provided
20812081 }
20822082
2083- if let y = call. getInt ( " y " ) {
2084- self . posY = CGFloat ( y )
2083+ if let yValue = call. getInt ( " y " ) {
2084+ self . posY = CGFloat ( yValue )
20852085 } else {
20862086 self . posY = - 1 // Auto-center if Y not provided
20872087 }
@@ -2110,22 +2110,22 @@ public class CameraPreview: CAPPlugin, CAPBridgedPlugin, CLLocationManagerDelega
21102110 return
21112111 }
21122112
2113- guard let x = call. getFloat ( " x " ) , let y = call. getFloat ( " y " ) else {
2113+ guard let xCoord = call. getFloat ( " x " ) , let yCoord = call. getFloat ( " y " ) else {
21142114 call. reject ( " x and y parameters are required " )
21152115 return
21162116 }
21172117
21182118 // Reject if values are outside 0-1 range
2119- if x < 0 || x > 1 || y < 0 || y > 1 {
2119+ if xCoord < 0 || xCoord > 1 || yCoord < 0 || yCoord > 1 {
21202120 call. reject ( " Focus coordinates must be between 0 and 1 " )
21212121 return
21222122 }
21232123
21242124 DispatchQueue . main. async {
21252125 do {
21262126 // Convert normalized coordinates to view coordinates
2127- let viewX = CGFloat ( x ) * self . previewView. bounds. width
2128- let viewY = CGFloat ( y ) * self . previewView. bounds. height
2127+ let viewX = CGFloat ( xCoord ) * self . previewView. bounds. width
2128+ let viewY = CGFloat ( yCoord ) * self . previewView. bounds. height
21292129 let focusPoint = CGPoint ( x: viewX, y: viewY)
21302130
21312131 // Convert view coordinates to device coordinates
@@ -2235,13 +2235,13 @@ public class CameraPreview: CAPPlugin, CAPBridgedPlugin, CLLocationManagerDelega
22352235 // Snap to valid range and step
22362236 var range = try self . cameraController. getExposureCompensationRange ( )
22372237 if range. step <= 0 { range. step = 0.1 }
2238- let lo = min ( range. min, range. max)
2239- let hi = max ( range. min, range. max)
2240- // Clamp to [lo, hi ]
2241- value = max ( lo , min ( hi , value) )
2238+ let minValue = min ( range. min, range. max)
2239+ let maxValue = max ( range. min, range. max)
2240+ // Clamp to [minValue, maxValue ]
2241+ value = max ( minValue , min ( maxValue , value) )
22422242 // Snap to nearest step
2243- let steps = round ( ( value - lo ) / range. step)
2244- let snapped = lo + steps * range. step
2243+ let steps = round ( ( value - minValue ) / range. step)
2244+ let snapped = minValue + steps * range. step
22452245
22462246 try self . cameraController. setExposureCompensation ( snapped)
22472247 call. resolve ( )
0 commit comments