mirror of
https://codeberg.org/comaps/comaps
synced 2025-12-20 13:23:59 +00:00
[ios] Skip CarPlay VC from updating the viewport when CP was disabed
The updateVisibleViewPortToDefaultState was called from the `viewDidLayoutSubviews` when the VC is removed from the stack, updates the viewport unexpectedly and overwrite the correct viewport with CP screen size. It may break the viewport when switching to the phone. Signed-off-by: Kiryl Kaveryn <kirylkaveryn@gmail.com>
This commit is contained in:
committed by
Yannik Bloscheck
parent
056711f4bd
commit
47f16c5b89
@@ -181,7 +181,7 @@ final class CarPlayMapViewController: MWMViewController {
|
|||||||
frame.origin = origin
|
frame.origin = origin
|
||||||
frame.size = CGSize(width: viewBounds.width - origin.x,
|
frame.size = CGSize(width: viewBounds.width - origin.x,
|
||||||
height: viewBounds.height - origin.y)
|
height: viewBounds.height - origin.y)
|
||||||
FrameworkHelper.setVisibleViewport(frame, scaleFactor: mapView?.contentScaleFactor ?? 1)
|
updateVisibleViewPort(frame: frame)
|
||||||
}
|
}
|
||||||
|
|
||||||
private func updateVisibleViewPortToNavigationState() {
|
private func updateVisibleViewPortToNavigationState() {
|
||||||
@@ -194,11 +194,16 @@ final class CarPlayMapViewController: MWMViewController {
|
|||||||
frame.origin = origin
|
frame.origin = origin
|
||||||
frame.size = CGSize(width: viewBounds.width - (origin.x + mapControlsWidth),
|
frame.size = CGSize(width: viewBounds.width - (origin.x + mapControlsWidth),
|
||||||
height: viewBounds.height - origin.y)
|
height: viewBounds.height - origin.y)
|
||||||
FrameworkHelper.setVisibleViewport(frame, scaleFactor: mapView?.contentScaleFactor ?? 1)
|
updateVisibleViewPort(frame: frame)
|
||||||
}
|
}
|
||||||
|
|
||||||
private func updateVisibleViewPortToDefaultState() {
|
private func updateVisibleViewPortToDefaultState() {
|
||||||
FrameworkHelper.setVisibleViewport(view.bounds, scaleFactor: mapView?.contentScaleFactor ?? 1)
|
updateVisibleViewPort(frame: view.bounds)
|
||||||
|
}
|
||||||
|
|
||||||
|
private func updateVisibleViewPort(frame: CGRect) {
|
||||||
|
guard CarPlayService.shared.isCarplayActivated else { return }
|
||||||
|
FrameworkHelper.setVisibleViewport(frame, scaleFactor: mapView?.contentScaleFactor ?? 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) {
|
override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) {
|
||||||
|
|||||||
Reference in New Issue
Block a user