[isolines] IsVisible method added.

This commit is contained in:
Daria Volvenkova 2020-05-20 20:52:32 +03:00 committed by Arsentiy Milchakov
parent 117993ca33
commit 5e0070fb05
2 changed files with 11 additions and 1 deletions

View file

@ -84,13 +84,21 @@ bool IsolinesManager::IsEnabled() const
return m_state != IsolinesState::Disabled;
}
bool IsolinesManager::IsVisible() const
{
return m_currentModelView && df::GetDrawTileScale(*m_currentModelView) >= kMinIsolinesZoom;
}
void IsolinesManager::UpdateViewport(ScreenBase const & screen)
{
if (screen.GlobalRect().GetLocalRect().IsEmptyInterior())
return;
m_currentModelView.reset(screen);
if (!IsEnabled())
return;
if (df::GetZoomLevel(screen.GetScale()) < kMinIsolinesZoom)
if (!IsVisible())
{
ChangeState(IsolinesState::Enabled);
return;

View file

@ -42,6 +42,8 @@ public:
void SetEnabled(bool enabled);
bool IsEnabled() const;
bool IsVisible() const;
void UpdateViewport(ScreenBase const & screen);
void Invalidate();