[search] Fixed dancing search results.

This commit is contained in:
Yuri Gorshenin 2017-11-01 18:05:33 +03:00 committed by mpimenov
parent 4604db2aae
commit d96212bc1f
3 changed files with 8 additions and 6 deletions

View file

@ -4,6 +4,7 @@
#include "coding/internal/file_data.hpp"
#include "storage/country_info_getter.hpp"
#include "storage/storage.hpp"
#include "storage/storage_helpers.hpp"

View file

@ -285,6 +285,8 @@ void Framework::OnViewportChanged(ScreenBase const & screen)
{
m_currentModelView = screen;
auto const forceSearchInViewport = !m_isViewportInitialized;
if (!m_isViewportInitialized)
{
m_isViewportInitialized = true;
@ -300,7 +302,7 @@ void Framework::OnViewportChanged(ScreenBase const & screen)
}
}
PokeSearchInViewport();
PokeSearchInViewport(forceSearchInViewport);
m_trafficManager.UpdateViewport(m_currentModelView);
m_localAdsManager.UpdateViewport(m_currentModelView);
@ -1326,16 +1328,15 @@ void Framework::SetCurrentCountryChangedListener(TCurrentCountryChanged const &
m_lastReportedCountry = kInvalidCountryId;
}
void Framework::PokeSearchInViewport()
void Framework::PokeSearchInViewport(bool forceSearch)
{
if (!m_isViewportInitialized || !IsViewportSearchActive())
return;
auto & intent = m_searchIntents[static_cast<size_t>(search::Mode::Viewport)];
auto & params = intent.m_params;
auto params = m_searchIntents[static_cast<size_t>(search::Mode::Viewport)].m_params;
SetViewportIfPossible(params);
SetCurrentPositionIfPossible(params);
Search(intent);
Search(params, forceSearch);
}
bool Framework::SearchEverywhere(search::EverywhereSearchParams const & params)

View file

@ -557,7 +557,7 @@ public:
// When search in viewport is active or delayed, restarts search in
// viewport.
void PokeSearchInViewport();
void PokeSearchInViewport(bool forceSearch = true);
// Search everywhere.
bool SearchEverywhere(search::EverywhereSearchParams const & params);