Fix gallery controls being positioned incorrectly in landscape
This commit is contained in:
parent
4ea61542a0
commit
666d2c468a
|
@ -386,7 +386,18 @@ class GalleryItemViewController: UIViewController {
|
|||
47, // iPhone 12, 12 Pro, 12 Pro Max, 13, 13 Pro, 13 Pro Max, 14, 14 Plus
|
||||
50, // iPhone 12 mini, 13 mini
|
||||
]
|
||||
if notchedDeviceTopInsets.contains(view.safeAreaInsets.top) {
|
||||
let topInset: CGFloat
|
||||
switch view.window?.windowScene?.interfaceOrientation {
|
||||
case .portraitUpsideDown:
|
||||
topInset = view.safeAreaInsets.bottom
|
||||
case .landscapeLeft:
|
||||
topInset = view.safeAreaInsets.right
|
||||
case .landscapeRight:
|
||||
topInset = view.safeAreaInsets.left
|
||||
default:
|
||||
topInset = view.safeAreaInsets.top
|
||||
}
|
||||
if notchedDeviceTopInsets.contains(topInset) {
|
||||
// the notch width is not the same for the iPhones 13,
|
||||
// but what we actually want is the same offset from the edges
|
||||
// since the corner radius didn't change
|
||||
|
@ -395,7 +406,7 @@ class GalleryItemViewController: UIViewController {
|
|||
let offset = (earWidth - (shareButton.imageView?.bounds.width ?? 0)) / 2
|
||||
shareButtonLeadingConstraint.constant = offset
|
||||
closeButtonTrailingConstraint.constant = offset
|
||||
} else if view.safeAreaInsets.top == 0 {
|
||||
} else if topInset == 0 {
|
||||
// square corner devices
|
||||
shareButtonLeadingConstraint.constant = 8
|
||||
shareButtonTopConstraint.constant = 8
|
||||
|
|
Loading…
Reference in New Issue