From c96128f241e6b4f88b93269e49261c57a612f699 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tam=C3=A1s=20B=C3=A1lint=20Misius?= Date: Mon, 14 Oct 2024 00:10:47 +0200 Subject: [PATCH] Show placeholder text in text fields even when focused This is fine, there's no particular benefit to hiding it when they are focused. I did find it annoying that the cursor got a bit tangled up with the placeholder text though, so I moved the text a bit to the right. --- src/gui/interface/Textbox.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/gui/interface/Textbox.cpp b/src/gui/interface/Textbox.cpp index a65c65eee..50ce7ea47 100644 --- a/src/gui/interface/Textbox.cpp +++ b/src/gui/interface/Textbox.cpp @@ -625,12 +625,9 @@ void Textbox::Draw(const Point& screenPos) screenPos + tp + Vec2{ cursorPositionX, cursorPositionY+9 }, 0xFFFFFF_rgb); } - else + if(!text.length()) { - if(!text.length()) - { - g->BlendText(screenPos + tp, placeHolder, textColour.NoAlpha().WithAlpha(170)); - } + g->BlendText(screenPos + tp + Vec2{ 3, 0 }, placeHolder, textColour.NoAlpha().WithAlpha(170)); } if(Appearance.icon) g->draw_icon(screenPos.X+iconPosition.X, screenPos.Y+iconPosition.Y, Appearance.icon);