From 9ef981f67b8029df5831286523fccdb5a9fd1467 Mon Sep 17 00:00:00 2001 From: Arsentiy Milchakov Date: Mon, 14 Jan 2019 10:16:09 +0300 Subject: [PATCH] [ios] review fix --- iphone/Maps/Classes/MapViewController.h | 2 ++ iphone/Maps/Classes/MapViewController.mm | 14 +++++++++++++- iphone/Maps/Classes/MapsAppDelegate.mm | 8 +++----- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/iphone/Maps/Classes/MapViewController.h b/iphone/Maps/Classes/MapViewController.h index a9ac214229..4dcf5be546 100644 --- a/iphone/Maps/Classes/MapViewController.h +++ b/iphone/Maps/Classes/MapViewController.h @@ -34,6 +34,8 @@ - (void)showRemoveAds; - (void)setPlacePageTopBound:(CGFloat)bound; ++ (void)setViewport:(double)lat lon:(double)lon zoomLevel:(int)zoomlevel; + - (void)initialize; @property(nonatomic, readonly) MWMMapViewControlsManager * controlsManager; diff --git a/iphone/Maps/Classes/MapViewController.mm b/iphone/Maps/Classes/MapViewController.mm index 4448aa785e..12b987ccb1 100644 --- a/iphone/Maps/Classes/MapViewController.mm +++ b/iphone/Maps/Classes/MapViewController.mm @@ -23,6 +23,8 @@ #include "drape_frontend/user_event_stream.hpp" +#include "geometry/mercator.hpp" + #import // If you have a "missing header error" here, then please run configure.sh script in the root repo @@ -745,10 +747,20 @@ BOOL gIsFirstMyPositionMode = YES; return _downloadDialog; } -- (void)setPlacePageTopBound:(CGFloat)bound; +- (void)setPlacePageTopBound:(CGFloat)bound { self.visibleAreaBottom.constant = bound; self.sideButtonsAreaBottom.constant = bound; } ++ (void)setViewport:(double)lat lon:(double)lon zoomLevel:(int)zoomLevel +{ + Framework & f = GetFramework(); + + f.StopLocationFollow(); + + auto const center = MercatorBounds::FromLatLon(lat, lon); + f.SetViewportCenter(center, zoomLevel); +} + @end diff --git a/iphone/Maps/Classes/MapsAppDelegate.mm b/iphone/Maps/Classes/MapsAppDelegate.mm index 3a6666db5d..64ef267c95 100644 --- a/iphone/Maps/Classes/MapsAppDelegate.mm +++ b/iphone/Maps/Classes/MapsAppDelegate.mm @@ -39,8 +39,6 @@ #include "platform/http_thread_apple.h" #include "platform/local_country_file_utils.hpp" -#include "geometry/mercator.hpp" - #include "base/assert.hpp" #include "private.h" @@ -271,9 +269,9 @@ using namespace osm_auth_ios; if (request.m_isSearchOnMap) { ASSERT([self isDrapeEngineCreated], ()); - f.StopLocationFollow(); - auto const center = MercatorBounds::FromLatLon(request.m_centerLat, request.m_centerLon); - f.SetViewportCenter(center, kSearchInViewportZoom); + [MapViewController setViewport:request.m_centerLat + lon:request.m_centerLon + zoomLevel:kSearchInViewportZoom]; [manager searchTextOnMap:query forInputLocale:locale]; } else