mirror of
https://codeberg.org/comaps/comaps
synced 2026-01-08 05:17:56 +00:00
[ios] The viewport is calculated using the safe area insets
Instead of manual origin and frame calculation. It fixes the issue when the location arrow and road are not centered while navigation. Signed-off-by: Kiryl Kaveryn <kirylkaveryn@gmail.com>
This commit is contained in:
committed by
Yannik Bloscheck
parent
47f16c5b89
commit
8520f32f2d
@@ -173,28 +173,11 @@ final class CarPlayMapViewController: MWMViewController {
|
||||
}
|
||||
|
||||
private func updateVisibleViewPortToPreviewState() {
|
||||
let viewBounds = view.bounds
|
||||
let previewWidth = self.view.frame.width * 0.45
|
||||
let navigationHeight: CGFloat = 45.0
|
||||
var frame = CGRect.zero
|
||||
let origin = isLeftWheelCar ? CGPoint(x: previewWidth, y: navigationHeight) : CGPoint(x: 0, y: navigationHeight)
|
||||
frame.origin = origin
|
||||
frame.size = CGSize(width: viewBounds.width - origin.x,
|
||||
height: viewBounds.height - origin.y)
|
||||
updateVisibleViewPort(frame: frame)
|
||||
updateVisibleViewPort(frame: view.frame.inset(by: view.safeAreaInsets))
|
||||
}
|
||||
|
||||
private func updateVisibleViewPortToNavigationState() {
|
||||
let viewBounds = view.bounds
|
||||
let previewWidth = viewBounds.width * 0.45
|
||||
let mapControlsWidth = viewBounds.width * 0.15
|
||||
let navigationHeight: CGFloat = 45.0
|
||||
var frame = CGRect.zero
|
||||
let origin = isLeftWheelCar ? CGPoint(x: previewWidth, y: navigationHeight) : CGPoint(x: 0, y: navigationHeight)
|
||||
frame.origin = origin
|
||||
frame.size = CGSize(width: viewBounds.width - (origin.x + mapControlsWidth),
|
||||
height: viewBounds.height - origin.y)
|
||||
updateVisibleViewPort(frame: frame)
|
||||
updateVisibleViewPort(frame: view.frame.inset(by: view.safeAreaInsets))
|
||||
}
|
||||
|
||||
private func updateVisibleViewPortToDefaultState() {
|
||||
|
||||
Reference in New Issue
Block a user