Skip to content

Commit 4c238b6

Browse files
authored
Merge pull request #46 from what3words/bug/ocr-view-frame
Update ocr view frame
2 parents 1d51c97 + fd8e99d commit 4c238b6

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

Sources/W3WSwiftComponentsOcr/W3WOcrViewController.swift

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -526,17 +526,14 @@ open class W3WOcrViewController: W3WViewController {
526526
height = width * W3WSettings.ocrViewfinderRatioLandscape
527527
}
528528
let crop = CGRect(origin: CGPoint(x: (UIScreen.main.bounds.width - width) / 2,
529-
y: topMargin + max(closeButtonSize, W3WMargin.heavy.value) + W3WMargin.light.value),
529+
y: topMargin + closeButtonSize + W3WMargin.light.value),
530530
size: CGSize(width: width, height: height))
531531
ocrView.set(crop: crop)
532532
}
533533
}
534534

535535
var topMargin: CGFloat {
536-
if isPresentedModally() {
537-
return modalPresentationStyle == .fullScreen ? W3WSettings.topSafeArea : 0.0
538-
}
539-
return W3WSettings.topSafeArea
536+
return shouldShowCloseButton ? closeButton.frame.minY : W3WMargin.heavy.value
540537
}
541538

542539
/// w3w Logo
@@ -566,6 +563,7 @@ open class W3WOcrViewController: W3WViewController {
566563
closeButton.trailingAnchor.constraint(equalTo: view.trailingAnchor),
567564
closeButton.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor)
568565
])
566+
closeButton.setNeedsLayout()
569567
}
570568

571569
@objc open func didTouchCloseButton() {

0 commit comments

Comments
 (0)