mirror of
https://github.com/simplezhli/flutter_barcode_reader.git
synced 2024-11-22 16:39:23 +08:00
Fixed the position of the scan line
This commit is contained in:
parent
e0cc5c3bc2
commit
770bb47d6c
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user