capacitor-community / barcode-scanner

A fast and efficient (QR) barcode scanner for Capacitor
MIT License
437 stars 172 forks source link

Be able to specify the dimensions of the scan view #136

Closed csurbier closed 1 year ago

csurbier commented 2 years ago

It should be nice to avoid having the full screen for scanning and having an option to pass the dimensions (x,y,width,height) of the desired scan view.

In the plugin code, values are hardcoded: public override func load() { self.cameraView = CameraView(frame: CGRect(x: 0, y: 0, width: UIScreen.main.bounds.width, height: UIScreen.main.bounds.height)) self.cameraView.autoresizingMask = [.flexibleWidth, .flexibleHeight] }

Describe the solution you'd like Be able to pass the x,y,width,height as parameters and the plugin will initialize the CameraView based on those parameters.

Thanks Christophe

thegnuu commented 1 year ago

@csurbier the ml-kit version will be finished soon, and codes scanned there will return the position of the code, therefore you will be able to make sure only codes in a given area will be used