forked from organicmaps/organicmaps
Fix location zoom level with new tile scale coverage logic.
This commit is contained in:
parent
1aeb022fd0
commit
036c71dfb2
3 changed files with 11 additions and 22 deletions
|
@ -270,7 +270,7 @@ double Framework::GetVisualScale() const
|
|||
|
||||
int Framework::GetScaleEtalonSize() const
|
||||
{
|
||||
return (m_renderPolicy ? m_renderPolicy->ScaleEtalonSize() : 512 + 256);
|
||||
return (m_renderPolicy ? m_renderPolicy->ScaleEtalonSize() : 512);
|
||||
}
|
||||
|
||||
void Framework::DeleteCountry(TIndex const & index)
|
||||
|
@ -927,21 +927,8 @@ void Framework::ShowRectFixed(m2::AnyRectD const & r)
|
|||
m2::AnyRectD rect(r);
|
||||
CheckMinGlobalRect(rect);
|
||||
|
||||
/*
|
||||
if (!m_renderPolicy)
|
||||
{
|
||||
m_pendingFixedRect = rect;
|
||||
m_hasPendingShowRectFixed = true;
|
||||
return;
|
||||
}
|
||||
*/
|
||||
|
||||
//size_t const sz = m_renderPolicy->ScaleEtalonSize();
|
||||
|
||||
/// @todo Get stored value instead of m_renderPolicy call because of invalid render policy here.
|
||||
int const etalonSize = GetScaleEtalonSize();
|
||||
m2::RectD etalonRect(0, 0, etalonSize, etalonSize);
|
||||
etalonRect.Offset(-etalonSize / 2, -etalonSize);
|
||||
double const halfSize = GetScaleEtalonSize() / 2.0;
|
||||
m2::RectD etalonRect(-halfSize, -halfSize, halfSize, halfSize);
|
||||
|
||||
m2::PointD const pxCenter = m_navigator.Screen().PixelRect().Center();
|
||||
etalonRect.Offset(pxCenter);
|
||||
|
|
|
@ -86,11 +86,8 @@ protected:
|
|||
|
||||
double m_StartForegroundTime;
|
||||
|
||||
//bool m_hasPendingInvalidate, m_doForceUpdate, m_queryMaxScaleMode, m_drawPlacemark, m_hasPendingShowRectFixed;
|
||||
bool m_queryMaxScaleMode, m_drawPlacemark;
|
||||
|
||||
//m2::RectD m_pendingFixedRect;
|
||||
//m2::AnyRectD m_invalidRect;
|
||||
m2::PointD m_placemark;
|
||||
|
||||
double const m_metresMinWidth;
|
||||
|
|
|
@ -152,20 +152,25 @@ namespace location
|
|||
int const rectScale = scales::GetScaleLevel(rect);
|
||||
int setScale = -1;
|
||||
|
||||
// correct rect scale if country isn't downloaded
|
||||
// Correct rect scale if country isn't downloaded.
|
||||
int const upperScale = scales::GetUpperWorldScale();
|
||||
if (rectScale > upperScale && !m_framework->IsCountryLoaded(center))
|
||||
setScale = upperScale;
|
||||
else
|
||||
{
|
||||
// correct rect scale for best user experience
|
||||
// Correct scale if it's too small.
|
||||
int const bestScale = scales::GetUpperScale() - 1;
|
||||
if (rectScale > bestScale)
|
||||
setScale = bestScale;
|
||||
}
|
||||
|
||||
if (setScale != -1)
|
||||
rect = scales::GetRectForLevel(setScale, center, 1.0);
|
||||
{
|
||||
/// @todo Correct rect scale for best user experience.
|
||||
/// The logic of GetRectForLevel differs from tile scale calculating logic
|
||||
/// (@see initial_level in scales.cpp).
|
||||
rect = scales::GetRectForLevel(setScale + 0.51, center, 1.0);
|
||||
}
|
||||
|
||||
m_framework->ShowRectEx(rect);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue