[drape] Deep links opening works as expected only with animation ?!

Signed-off-by: Viktor Govako <viktor.govako@gmail.com>
This commit is contained in:
Viktor Govako 2022-10-03 19:30:31 +03:00
parent aa9cc3eef7
commit 1da7cc93ac
5 changed files with 15 additions and 12 deletions

View file

@ -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<double>(lat),
static_cast<double>(lon));
frm()->SetViewportCenter(center, static_cast<int>(zoom), static_cast<bool>(isAnim));
// isAnim = true because of previous nativeTurnOnChoosePositionMode animations.
frm()->SetViewportCenter(mercator::FromLatLon(lat, lon), static_cast<int>(zoom), true /* isAnim */);
}
JNIEXPORT void JNICALL

View file

@ -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);

View file

@ -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;
}
}

View file

@ -832,11 +832,14 @@ void FrontendRenderer::AcceptMessage(ref_ptr<Message> 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<SetCenterEvent>(pt, zoom, true /* isAnim */, false /* trackVisibleViewport */,
nullptr /* parallelAnimCreator */));
}

View file

@ -1520,8 +1520,10 @@ void Framework::CreateDrapeEngine(ref_ptr<dp::GraphicsContextFactory> 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)