Fixed the position of the scan line

This commit is contained in:
Julian Finkler 2020-01-12 12:34:25 +01:00
parent e0cc5c3bc2
commit 770bb47d6c

View File

@ -89,10 +89,10 @@
CGFloat frameHeight = rect.size.height; CGFloat frameHeight = rect.size.height;
BOOL isLandscape = frameWidth > frameHeight; BOOL isLandscape = frameWidth > frameHeight;
CGFloat widthOnPotrait = isLandscape ? frameHeight : frameWidth; CGFloat widthOnPortrait = isLandscape ? frameHeight : frameWidth;
CGFloat heightMultiplier = 3.0/4.0; // 4:3 aspect ratio CGFloat scanRectWidth = widthOnPortrait * 0.8f;
CGFloat scanRectWidth = widthOnPotrait * 0.8f; CGFloat aspectRatio = 3.0/4.0;
CGFloat scanRectHeight = scanRectWidth * heightMultiplier; CGFloat scanRectHeight = scanRectWidth * aspectRatio;
if(isLandscape) { if(isLandscape) {
CGFloat navbarHeight = 32; CGFloat navbarHeight = 32;
@ -106,8 +106,8 @@
- (CGRect)scanLineRect { - (CGRect)scanLineRect {
CGRect scanRect = [self scanRect]; CGRect scanRect = [self scanRect];
CGRect rect = self.frame; CGFloat positionY = scanRect.origin.y + (scanRect.size.height / 2);
return CGRectMake(scanRect.origin.x, rect.size.height / 2, scanRect.size.width, 1); return CGRectMake(scanRect.origin.x, positionY, scanRect.size.width, 1);
} }
@end @end