Add some padding to the textview, buildfix

This commit is contained in:
Henrik Rydgård committed 2023-01-31 21:26:12 +01:00
1 parent 4f20852953
commit 5154e5e7b8
3 files changed
+10 -4

No files matched your search

+4 -3
View File
@@ -998,7 +998,8 @@ void TextView::GetContentDimensionsBySpec(const UIContext &dc, MeasureSpec horiz
bounds.w -= bulletOffset;
}
dc.MeasureTextRect(small_ ? dc.theme->uiFontSmall : dc.theme->uiFont, 1.0f, 1.0f, text_.c_str(), (int)text_.length(), bounds, &w, &h, textAlign_);
w += pad_ * 2.0f;
h += pad_ * 2.0f;
if (bullet_) {
w += bulletOffset;
}
@@ -1044,9 +1045,9 @@ void TextView::Draw(UIContext &dc) {
if (shadow_) {
uint32_t shadowColor = 0x80000000;
dc.DrawTextRect(text_.c_str(), textBounds.Offset(1.0f, 1.0f), shadowColor, textAlign_);
dc.DrawTextRect(text_.c_str(), textBounds.Offset(1.0f + pad_, 1.0f + pad_), shadowColor, textAlign_);
}
dc.DrawTextRect(text_.c_str(), textBounds, textColor, textAlign_);
dc.DrawTextRect(text_.c_str(), textBounds.Offset(pad_, pad_), textColor, textAlign_);
if (small_) {
// If we changed font style, reset it.
dc.SetFontStyle(dc.theme->uiFont);