Ver código fonte

Correct scan area size on ios

flutter-beta
Tihomirov 4 anos atrás
pai
commit
b2ba000daf
1 arquivos alterados com 3 adições e 3 exclusões
  1. +3
    -3
      ios/Classes/QRView.swift

+ 3
- 3
ios/Classes/QRView.swift Ver arquivo

@@ -84,7 +84,7 @@ public class QRView:NSObject,FlutterPlatformView {
return previewView
}
func setDimensions(_ result: @escaping FlutterResult, width: Double, height: Double, scanArea: Double, scanAreaOffset: Double) {
func setDimensions(_ result: @escaping FlutterResult, width: Double, height: Double, scanAreaWidth: Double, scanAreaHeight: Double, scanAreaOffset: Double) {
// Then set the size of the preview area.
previewView.frame = CGRect(x: 0, y: 0, width: width, height: height)
@@ -103,9 +103,9 @@ public class QRView:NSObject,FlutterPlatformView {
}

// Set scanArea if provided.
if (scanArea != 0) {
if (scanAreaWidth != 0 && scanAreaHeight != 0) {
scanner?.didStartScanningBlock = {
self.scanner?.scanRect = CGRect(x: Double(midX) - (scanArea / 2), y: Double(midY) - (scanArea / 2), width: scanArea, height: scanArea)
self.scanner?.scanRect = CGRect(x: Double(midX) - (scanAreaWidth / 2), y: Double(midY) - (scanAreaHeight / 2), width: scanAreaWidth, height: scanAreaHeight)

// Set offset if provided.
if (scanAreaOffset != 0) {


Carregando…
Cancelar
Salvar