From 3de54b50343057eea33a8a8514ebfc335020186e Mon Sep 17 00:00:00 2001 From: Suraj1999 Date: Sun, 7 Jan 2024 17:22:18 +0530 Subject: [PATCH] bug fix related to initial zoom in a map --- .../Home/Main/View/HomeViewController.swift | 2 +- .../Home/Main/View/NavigationMapController.swift | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/animeal/src/Flows/Main/Modules/Home/Main/View/HomeViewController.swift b/animeal/src/Flows/Main/Modules/Home/Main/View/HomeViewController.swift index 136f5939..152bf5f8 100644 --- a/animeal/src/Flows/Main/Modules/Home/Main/View/HomeViewController.swift +++ b/animeal/src/Flows/Main/Modules/Home/Main/View/HomeViewController.swift @@ -384,7 +384,7 @@ private extension HomeViewController { latitude: 41.719545681547245, longitude: 44.78956025041992 ) - mapView.easeToLocation(tbilisiCenterCoordinates, duration: 0) + mapView.easeToDefaultZoomLocation(tbilisiCenterCoordinates, duration: 0) userLocationButton.isUserInteractionEnabled = false } } diff --git a/animeal/src/Flows/Main/Modules/Home/Main/View/NavigationMapController.swift b/animeal/src/Flows/Main/Modules/Home/Main/View/NavigationMapController.swift index b6a5d2d4..396105b5 100644 --- a/animeal/src/Flows/Main/Modules/Home/Main/View/NavigationMapController.swift +++ b/animeal/src/Flows/Main/Modules/Home/Main/View/NavigationMapController.swift @@ -117,6 +117,21 @@ class NavigationMapController: NavigationViewControllerDelegate { ) } + func easeToDefaultZoomLocation( + _ locationCoordinate: CLLocationCoordinate2D?, + duration: TimeInterval + ) { + var cameraOptions = camera(for: [locationCoordinate].compactMap { $0 }) + cameraOptions.zoom = 16.0 + navigationMapView.mapView.camera.ease( + to: cameraOptions, + duration: duration, + curve: .easeOut, + completion: nil + ) + } + + func easeToLocations( _ locationCoordinates: [CLLocationCoordinate2D], duration: TimeInterval,