From 770bb47d6c7df86ae0adf69ba38e61d6b05fc95e Mon Sep 17 00:00:00 2001 From: Julian Finkler Date: Sun, 12 Jan 2020 12:34:25 +0100 Subject: [PATCH] Fixed the position of the scan line --- ios/Classes/ScannerOverlay.m | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ios/Classes/ScannerOverlay.m b/ios/Classes/ScannerOverlay.m index eb8ca6f..7c415b9 100644 --- a/ios/Classes/ScannerOverlay.m +++ b/ios/Classes/ScannerOverlay.m @@ -89,10 +89,10 @@ CGFloat frameHeight = rect.size.height; BOOL isLandscape = frameWidth > frameHeight; - CGFloat widthOnPotrait = isLandscape ? frameHeight : frameWidth; - CGFloat heightMultiplier = 3.0/4.0; // 4:3 aspect ratio - CGFloat scanRectWidth = widthOnPotrait * 0.8f; - CGFloat scanRectHeight = scanRectWidth * heightMultiplier; + CGFloat widthOnPortrait = isLandscape ? frameHeight : frameWidth; + CGFloat scanRectWidth = widthOnPortrait * 0.8f; + CGFloat aspectRatio = 3.0/4.0; + CGFloat scanRectHeight = scanRectWidth * aspectRatio; if(isLandscape) { CGFloat navbarHeight = 32; @@ -106,8 +106,8 @@ - (CGRect)scanLineRect { CGRect scanRect = [self scanRect]; - CGRect rect = self.frame; - return CGRectMake(scanRect.origin.x, rect.size.height / 2, scanRect.size.width, 1); + CGFloat positionY = scanRect.origin.y + (scanRect.size.height / 2); + return CGRectMake(scanRect.origin.x, positionY, scanRect.size.width, 1); } @end