From 8f1084b24f3d9cac3eaa741c95e6a53a8c53abb4 Mon Sep 17 00:00:00 2001 From: ITotalJustice <47043333+ITotalJustice@users.noreply.github.com> Date: Sat, 21 Dec 2024 16:32:36 +0000 Subject: [PATCH] fix text bounds in option box fixes #28 --- sphaira/source/ui/option_box.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/sphaira/source/ui/option_box.cpp b/sphaira/source/ui/option_box.cpp index 9e64fb4..10463d3 100644 --- a/sphaira/source/ui/option_box.cpp +++ b/sphaira/source/ui/option_box.cpp @@ -102,9 +102,15 @@ auto OptionBox::OnLayoutChange() -> void { } auto OptionBox::Draw(NVGcontext* vg, Theme* theme) -> void { + const float padding = 15; gfx::dimBackground(vg); gfx::drawRect(vg, m_pos, theme->elements[ThemeEntryID_SELECTED].colour); - gfx::drawText(vg, {m_pos.x + (m_pos.w / 2.f), m_pos.y + 110.f}, 26.f, theme->elements[ThemeEntryID_TEXT].colour, m_message.c_str(), NVG_ALIGN_CENTER | NVG_ALIGN_TOP); + + nvgSave(vg); + nvgTextLineHeight(vg, 1.5); + gfx::drawTextBox(vg, m_pos.x + padding, m_pos.y + 110.f, 26.f, m_pos.w - padding*2, theme->elements[ThemeEntryID_TEXT].colour, m_message.c_str(), NVG_ALIGN_CENTER | NVG_ALIGN_MIDDLE); + nvgRestore(vg); + gfx::drawRect(vg, m_spacer_line, theme->elements[ThemeEntryID_TEXT].colour); for (auto&p: m_entries) {