diff --git a/android/jni/com/mapswithme/maps/Framework.cpp b/android/jni/com/mapswithme/maps/Framework.cpp index 578ea6f9d5..0641c44a72 100644 --- a/android/jni/com/mapswithme/maps/Framework.cpp +++ b/android/jni/com/mapswithme/maps/Framework.cpp @@ -1784,12 +1784,10 @@ Java_com_mapswithme_maps_Framework_nativeSetPowerManagerScheme(JNIEnv *, jclass, } JNIEXPORT void JNICALL -Java_com_mapswithme_maps_Framework_nativeSetViewportCenter(JNIEnv *, jclass, jdouble lat, - jdouble lon, jint zoom, jboolean isAnim) +Java_com_mapswithme_maps_Framework_nativeSetViewportCenter(JNIEnv *, jclass, jdouble lat, jdouble lon, jint zoom) { - auto const center = mercator::FromLatLon(static_cast(lat), - static_cast(lon)); - frm()->SetViewportCenter(center, static_cast(zoom), static_cast(isAnim)); + // isAnim = true because of previous nativeTurnOnChoosePositionMode animations. + frm()->SetViewportCenter(mercator::FromLatLon(lat, lon), static_cast(zoom), true /* isAnim */); } JNIEXPORT void JNICALL diff --git a/android/src/com/mapswithme/maps/Framework.java b/android/src/com/mapswithme/maps/Framework.java index 2b63016077..03ea229ed5 100644 --- a/android/src/com/mapswithme/maps/Framework.java +++ b/android/src/com/mapswithme/maps/Framework.java @@ -378,8 +378,7 @@ public class Framework public static native void nativeSetPowerManagerFacility(int facilityType, boolean state); public static native int nativeGetPowerManagerScheme(); public static native void nativeSetPowerManagerScheme(int schemeType); - public static native void nativeSetViewportCenter(double lat, double lon, int zoom, - boolean isAnim); + public static native void nativeSetViewportCenter(double lat, double lon, int zoom); public static native void nativeStopLocationFollow(); public static native void nativeSetSearchViewport(double lat, double lon, int zoom); diff --git a/android/src/com/mapswithme/maps/intent/Factory.java b/android/src/com/mapswithme/maps/intent/Factory.java index 6408a3f782..67a1f69cd3 100644 --- a/android/src/com/mapswithme/maps/intent/Factory.java +++ b/android/src/com/mapswithme/maps/intent/Factory.java @@ -240,7 +240,7 @@ public class Factory if (latlon[0] != 0.0 || latlon[1] != 0.0) { Framework.nativeStopLocationFollow(); - Framework.nativeSetViewportCenter(latlon[0], latlon[1], SEARCH_IN_VIEWPORT_ZOOM, false); + Framework.nativeSetViewportCenter(latlon[0], latlon[1], SEARCH_IN_VIEWPORT_ZOOM); // We need to update viewport for search api manually because of drape engine // will not notify subscribers when search activity is shown. if (!request.mIsSearchOnMap) @@ -251,14 +251,15 @@ public class Factory } case ParsingResult.TYPE_CROSSHAIR: { - final String appName = Framework.nativeGetParsedAppName(); + target.showPositionChooserForAPI(Framework.nativeGetParsedAppName()); + final double[] latlon = Framework.nativeGetParsedCenterLatLon(); if (latlon[0] != 0.0 || latlon[1] != 0.0) { Framework.nativeStopLocationFollow(); - Framework.nativeSetViewportCenter(latlon[0], latlon[1], SEARCH_IN_VIEWPORT_ZOOM, false); + Framework.nativeSetViewportCenter(latlon[0], latlon[1], SEARCH_IN_VIEWPORT_ZOOM); } - target.showPositionChooserForAPI(appName); + return true; } } diff --git a/drape_frontend/frontend_renderer.cpp b/drape_frontend/frontend_renderer.cpp index 0eff10c8f0..d26e62e23b 100755 --- a/drape_frontend/frontend_renderer.cpp +++ b/drape_frontend/frontend_renderer.cpp @@ -832,11 +832,14 @@ void FrontendRenderer::AcceptMessage(ref_ptr message) } else { - m2::PointD const pt = msg->HasPosition()? msg->GetPosition() : + // Exact position for POI or screen's center for Add place on map. + m2::PointD const pt = msg->HasPosition() ? msg->GetPosition() : m_userEventStream.GetCurrentScreen().GlobalRect().Center(); + int zoom = kDoNotChangeZoom; if (GetCurrentZoom() < scales::GetAddNewPlaceScale()) zoom = scales::GetAddNewPlaceScale(); + AddUserEvent(make_unique_dp(pt, zoom, true /* isAnim */, false /* trackVisibleViewport */, nullptr /* parallelAnimCreator */)); } diff --git a/map/framework.cpp b/map/framework.cpp index 1598519b11..9621ac7d9b 100644 --- a/map/framework.cpp +++ b/map/framework.cpp @@ -1520,8 +1520,10 @@ void Framework::CreateDrapeEngine(ref_ptr contextFac OnSize(params.m_surfaceWidth, params.m_surfaceHeight); Allow3dMode(allow3d, allow3dBuildings); + LoadViewport(); + /// @todo Have doubts that this call below is actually needed. SetVisibleViewport(m2::RectD(0, 0, params.m_surfaceWidth, params.m_surfaceHeight)); if (m_connectToGpsTrack)