From a8d79afbe0ffcd89a47f61e67f270eaee4b1f5ba Mon Sep 17 00:00:00 2001 From: Anatoliy Tomilov Date: Tue, 25 Aug 2020 14:58:06 +0500 Subject: [PATCH] [drape] [Booking] Correct calculations of text metrics for badge width adjustment MAPSME-14628 --- drape_frontend/user_mark_shapes.cpp | 3 ++- map/search_mark.cpp | 6 ------ 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/drape_frontend/user_mark_shapes.cpp b/drape_frontend/user_mark_shapes.cpp index d5be528127..9ce4c4187c 100644 --- a/drape_frontend/user_mark_shapes.cpp +++ b/drape_frontend/user_mark_shapes.cpp @@ -263,9 +263,10 @@ void GeneratePoiSymbolShape(ref_ptr context, ref_ptrGetSymbolRegion(symbolName, region); float const pixelHalfWidth = 0.5f * region.GetPixelSize().x; + auto const vs = static_cast(df::VisualParams::Instance().GetVisualScale()); float constexpr kBadgeMarginsAdjustmentFactor = 4.0f; float const badgeMarginsAdjustment = - kBadgeMarginsAdjustmentFactor * titleDecl.m_primaryOffset.x; + kBadgeMarginsAdjustmentFactor * titleDecl.m_primaryOffset.x * vs; params.m_pixelWidth = 3.0f * pixelHalfWidth + textWidth + badgeMarginsAdjustment; params.m_offset.x += 0.5f * (pixelHalfWidth + textWidth + badgeMarginsAdjustment); diff --git a/map/search_mark.cpp b/map/search_mark.cpp index f39a753f3b..809b4ea951 100644 --- a/map/search_mark.cpp +++ b/map/search_mark.cpp @@ -133,10 +133,6 @@ int constexpr kUGCBadgeMinZoomLevel = scales::GetUpperCountryScale(); int constexpr kGoodRatingZoomLevel = kWorldZoomLevel; int constexpr kBadRatingZoomLevel = scales::GetUpperComfortScale(); -// Offset for price text relative to symbol and adjustment of price chip size -// for better margins of price text into the chip -float constexpr kBadgeTextSpecialOffset = -4.0f; - std::string GetSymbol(SearchMarkType searchMarkType, bool hasLocalAds, bool hasRating) { if (searchMarkType == SearchMarkType::Default && hasRating) @@ -415,7 +411,6 @@ drape_ptr SearchMarkPoint::GetTitleDecl() const reasonTitleDecl.m_primaryTextFont.m_color = df::GetColorConstant("HotelPriceText"); reasonTitleDecl.m_primaryTextFont.m_color.PremultiplyAlpha(kOutOfFiltersTextOpacity); reasonTitleDecl.m_primaryTextFont.m_size = fontSize; - reasonTitleDecl.m_primaryOffset.x = kBadgeTextSpecialOffset; reasonTitleDecl.m_primaryText = m_reason; } @@ -445,7 +440,6 @@ drape_ptr SearchMarkPoint::GetTitleDecl() const badgeTitleDecl.m_primaryTextFont.m_color = df::GetColorConstant("HotelPriceText"); badgeTitleDecl.m_primaryTextFont.m_color.PremultiplyAlpha(GetSymbolOpacity()); badgeTitleDecl.m_primaryTextFont.m_size = fontSize; - badgeTitleDecl.m_primaryOffset.x = kBadgeTextSpecialOffset; if (HasPrice()) {