Skip to content

Commit c1bb161

Browse files
committed
remove unsued code block
1 parent 596c050 commit c1bb161

File tree

1 file changed

+1
-35
lines changed

1 file changed

+1
-35
lines changed

darwin/mobile_scanner/Sources/mobile_scanner/MobileScannerPlugin.swift

Lines changed: 1 addition & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -167,12 +167,7 @@ public class MobileScannerPlugin: NSObject, FlutterPlugin, FlutterStreamHandler,
167167
return
168168
}
169169

170-
let barcodes: [VNBarcodeObservation] = results.compactMap({ barcode in
171-
// If there is a scan window, check if the barcode is within said scan window.
172-
// if self?.scanWindow != nil && cgImage != nil && !(self?.isBarcodeInsideScanWindow(barcodeObservation: barcode, imageSize: CGSize(width: cgImage!.width, height: cgImage!.height)) ?? false) {
173-
// return nil
174-
// }
175-
//
170+
let barcodes: [VNBarcodeObservation] = results.compactMap({ barcode in
176171
return barcode
177172
})
178173

@@ -208,20 +203,9 @@ public class MobileScannerPlugin: NSObject, FlutterPlugin, FlutterStreamHandler,
208203
}
209204

210205
// Set the region of interest to match scanWindow
211-
// if let scanWindow = self?.scanWindow {
212-
// barcodeRequest.regionOfInterest = scanWindow
213-
// }
214-
// Set the region of interest to match scanWindow
215206
if let scanWindow = self?.scanWindow {
216207
barcodeRequest.regionOfInterest = scanWindow
217208
}
218-
219-
220-
// !(self?.isBarcodeInsideScanWindow(barcodeObservation: barcode, imageSize: CGSize(width: cgImage!.width, height: cgImage!.height))
221-
// if (self?.scanWindow != nil) {
222-
// barcodeRequest.regionOfInterest = self!.scanWindow!
223-
// }
224-
225209

226210
try imageRequestHandler.perform([barcodeRequest])
227211
} catch let error {
@@ -279,24 +263,6 @@ public class MobileScannerPlugin: NSObject, FlutterPlugin, FlutterStreamHandler,
279263
result(nil)
280264
}
281265

282-
func isBarcodeInsideScanWindow(barcodeObservation: VNBarcodeObservation, imageSize: CGSize) -> Bool {
283-
let boundingBox = barcodeObservation.boundingBox
284-
285-
// Adjust boundingBox by inverting the y-axis
286-
let adjustedBoundingBox = CGRect(
287-
x: boundingBox.minX,
288-
y: 1.0 - boundingBox.maxY,
289-
width: boundingBox.width,
290-
height: boundingBox.height
291-
)
292-
293-
let intersects = scanWindow!.contains(adjustedBoundingBox)
294-
295-
// Check if the adjusted bounding box intersects with or is within the scan window
296-
return intersects
297-
}
298-
299-
300266
private func getVideoOrientation() -> AVCaptureVideoOrientation {
301267
#if os(iOS)
302268
var videoOrientation: AVCaptureVideoOrientation

0 commit comments

Comments
 (0)