Showing
1 changed file
with
9 additions
and
5 deletions
| @@ -250,12 +250,16 @@ public class SwiftMobileScannerPlugin: NSObject, FlutterPlugin, FlutterStreamHan | @@ -250,12 +250,16 @@ public class SwiftMobileScannerPlugin: NSObject, FlutterPlugin, FlutterStreamHan | ||
| 250 | 250 | ||
| 251 | let captureMetadataOutput = AVCaptureMetadataOutput() | 251 | let captureMetadataOutput = AVCaptureMetadataOutput() |
| 252 | 252 | ||
| 253 | - let x = scanWindowData![0] / CGFloat(demensions.width) | ||
| 254 | - let y = scanWindowData![1] / CGFloat(demensions.height) | ||
| 255 | - let w = scanWindowData![2] - scanWindowData![0] / CGFloat(demensions.width) | ||
| 256 | - let h = scanWindowData![3] - scanWindowData![1] / CGFloat(demensions.height) | 253 | + let minX = scanWindowData![0] / CGFloat(demensions.width) |
| 254 | + let minY = scanWindowData![1] / CGFloat(demensions.height) | ||
| 257 | 255 | ||
| 258 | - captureMetadataOutput.rectOfInterest = CGRect(x: x, y: y, width: w, height: h) | 256 | + let maxX = scanWindowData![2] / CGFloat(demensions.width) |
| 257 | + let maxY = scanWindowData![3] / CGFloat(demensions.height) | ||
| 258 | + | ||
| 259 | + let width = maxX - minX | ||
| 260 | + let height = maxY - minY | ||
| 261 | + | ||
| 262 | + captureMetadataOutput.rectOfInterest = CGRect(x: minX, y: minY, width: width, height: height) | ||
| 259 | captureSession.addOutput(captureMetadataOutput) | 263 | captureSession.addOutput(captureMetadataOutput) |
| 260 | } | 264 | } |
| 261 | 265 |
-
Please register or login to post a comment