From d091b981a786c9c6f02af24e8ef087a4fca8e0e3 Mon Sep 17 00:00:00 2001 From: Daria Volvenkova Date: Tue, 17 Apr 2018 19:21:09 +0300 Subject: [PATCH] Clip screen scale by max valid value. --- drape_frontend/screen_operations.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drape_frontend/screen_operations.cpp b/drape_frontend/screen_operations.cpp index 7e5dd93133..3950212dce 100644 --- a/drape_frontend/screen_operations.cpp +++ b/drape_frontend/screen_operations.cpp @@ -259,7 +259,13 @@ bool ApplyScale(m2::PointD const & pixelScaleCenter, double factor, ScreenBase & } if (!CheckMaxScale(tmp)) - return false; + { + // Set scale value slightly less than upper bound, to get closest valid zoom. + auto const correctedScale = GetScale((scales::GetUpperStyleScale() + 1) * 0.995); + tmp.SetScale(correctedScale); + if (!CheckMaxScale(tmp)) + return false; + } // re-checking the borders, as we might violate them a bit (don't know why). if (!CheckBorders(tmp))