diff --git a/iphone/Maps/UI/CarPlay/CarPlayMapViewController.swift b/iphone/Maps/UI/CarPlay/CarPlayMapViewController.swift index 65881c05c..2146d2c60 100644 --- a/iphone/Maps/UI/CarPlay/CarPlayMapViewController.swift +++ b/iphone/Maps/UI/CarPlay/CarPlayMapViewController.swift @@ -181,7 +181,7 @@ final class CarPlayMapViewController: MWMViewController { frame.origin = origin frame.size = CGSize(width: viewBounds.width - origin.x, height: viewBounds.height - origin.y) - FrameworkHelper.setVisibleViewport(frame, scaleFactor: mapView?.contentScaleFactor ?? 1) + updateVisibleViewPort(frame: frame) } private func updateVisibleViewPortToNavigationState() { @@ -194,11 +194,16 @@ final class CarPlayMapViewController: MWMViewController { frame.origin = origin frame.size = CGSize(width: viewBounds.width - (origin.x + mapControlsWidth), height: viewBounds.height - origin.y) - FrameworkHelper.setVisibleViewport(frame, scaleFactor: mapView?.contentScaleFactor ?? 1) + updateVisibleViewPort(frame: frame) } 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?) {