Assert fixed after drape engine creation when the screen rect setting is missing or invalid and current mode is follow and rotate.

This commit is contained in:
Daria Volvenkova 2016-03-29 14:51:54 +03:00
parent c0f3dce556
commit 897cd1f9be

View file

@ -32,6 +32,13 @@ DrapeEngine::DrapeEngine(Params && params)
if (!params.m_initialMyPositionMode.second && !settings::Get(settings::kLocationStateMode, mode))
mode = location::MODE_UNKNOWN_POSITION;
// If the screen rect setting in follow and rotate mode is missing or invalid, it could cause invalid animations,
// so the follow and rotate mode should be discarded.
m2::AnyRectD rect;
if (mode == location::MODE_ROTATE_AND_FOLLOW &&
!(settings::Get("ScreenClipRect", rect) && df::GetWorldRect().IsRectInside(rect.GetGlobalRect())))
mode = location::MODE_FOLLOW;
FrontendRenderer::Params frParams(make_ref(m_threadCommutator), params.m_factory,
make_ref(m_textureManager), m_viewport,
bind(&DrapeEngine::ModelViewChanged, this, _1),