[drape] [Booking] Correct calculations of text metrics for badge width adjustment MAPSME-14628

This commit is contained in:
Anatoliy Tomilov 2020-08-25 14:58:06 +05:00 committed by Maksim Andrianov
parent dd59773afc
commit a8d79afbe0
2 changed files with 2 additions and 7 deletions

View file

@ -263,9 +263,10 @@ void GeneratePoiSymbolShape(ref_ptr<dp::GraphicsContext> context, ref_ptr<dp::Te
textures->GetSymbolRegion(symbolName, region);
float const pixelHalfWidth = 0.5f * region.GetPixelSize().x;
auto const vs = static_cast<float>(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);

View file

@ -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<df::UserPointMark::TitlesInfo> 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<df::UserPointMark::TitlesInfo> 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())
{