[map] Fix the viewport when opening a geo: link (#6647)

* [map] Fix the viewport when opening a geo: link

Re-add lost trackVisibleViewport=true from the original implementation.

Closes #6641

Co-authored-by: Viktor Govako <viktor.govako@gmail.com>
Signed-off-by: Roman Tsisyk <roman@tsisyk.com>
This commit is contained in:
Roman Tsisyk 2023-11-24 23:47:01 +02:00 committed by GitHub
parent 95c80cbceb
commit 1b58a18f47
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 5 deletions

View file

@ -959,11 +959,11 @@ m2::PointD const & Framework::GetViewportCenter() const
return m_currentModelView.GetOrg();
}
void Framework::SetViewportCenter(m2::PointD const & pt, int zoomLevel /* = -1 */,
bool isAnim /* = true */)
void Framework::SetViewportCenter(m2::PointD const & pt, int zoomLevel /* = -1 */, bool isAnim /* = true */,
bool trackVisibleViewport /* = false */)
{
if (m_drapeEngine != nullptr)
m_drapeEngine->SetModelViewCenter(pt, zoomLevel, isAnim, false /* trackVisibleViewport */);
m_drapeEngine->SetModelViewCenter(pt, zoomLevel, isAnim, trackVisibleViewport);
}
m2::RectD Framework::GetCurrentViewport() const

View file

@ -497,7 +497,8 @@ public:
m2::PointD GetVisiblePixelCenter() const;
m2::PointD const & GetViewportCenter() const;
void SetViewportCenter(m2::PointD const & pt, int zoomLevel = -1, bool isAnim = true);
void SetViewportCenter(m2::PointD const & pt, int zoomLevel = -1, bool isAnim = true,
bool trackVisibleViewport = false);
m2::RectD GetCurrentViewport() const;
void SetVisibleViewport(m2::RectD const & rect);

View file

@ -461,7 +461,9 @@ void ParsedMapApi::ExecuteMapApiRequest(Framework & fm)
// ShowRect function interferes with ActivateMapSelection and we have strange behaviour as a result.
// Use more obvious SetModelViewCenter here.
fm.SetViewportCenter(center, zoomLevel, true);
/// @todo Funny, but animation is still present, but now centering works fine.
/// Looks like there is one more set viewport call somewhere.
fm.SetViewportCenter(center, zoomLevel, false /* isAnim */, true /* trackVisibleViewport */);
// Don't show the place page in case of multiple points.
if (m_mapPoints.size() > 1)