aboutsummaryrefslogtreecommitdiff
path: root/ShiftOS.Frontend/GUI
diff options
context:
space:
mode:
authorMichael <[email protected]>2017-08-03 10:04:48 -0400
committerMichael <[email protected]>2017-08-03 10:04:48 -0400
commitbe1b65d1c63c05f01164f9ab1395233ab367aedf (patch)
tree889283c64ba99b019da16049e3de3ea778113fbf /ShiftOS.Frontend/GUI
parent3ddd9f727f4fd6b9fa985ac56a6276610f4ddb24 (diff)
downloadshiftos_thereturn-be1b65d1c63c05f01164f9ab1395233ab367aedf.tar.gz
shiftos_thereturn-be1b65d1c63c05f01164f9ab1395233ab367aedf.tar.bz2
shiftos_thereturn-be1b65d1c63c05f01164f9ab1395233ab367aedf.zip
fix text positioning in textinput
Diffstat (limited to 'ShiftOS.Frontend/GUI')
-rw-r--r--ShiftOS.Frontend/GUI/TextInput.cs10
1 files changed, 7 insertions, 3 deletions
diff --git a/ShiftOS.Frontend/GUI/TextInput.cs b/ShiftOS.Frontend/GUI/TextInput.cs
index 8c37c28..381541b 100644
--- a/ShiftOS.Frontend/GUI/TextInput.cs
+++ b/ShiftOS.Frontend/GUI/TextInput.cs
@@ -134,23 +134,27 @@ namespace ShiftOS.Frontend.GUI
gfx.DrawRectangle(0, 0, Width, Height, UIManager.SkinTextures["ControlTextColor"]);
gfx.DrawRectangle(1, 1, Width - 2, Height - 2, UIManager.SkinTextures["ControlColor"]);
+ int textY = (Height - _font.Height) / 2;
+ int caretHeight = _font.Height;
+
+
if (!string.IsNullOrWhiteSpace(Text))
{
- gfx.DrawString(Text, (int)(2 - _textDrawOffset), 2, LoadedSkin.ControlTextColor.ToMonoColor(), _font);
+ gfx.DrawString(Text, (int)(2 - _textDrawOffset), textY, LoadedSkin.ControlTextColor.ToMonoColor(), _font);
}
if (IsFocusedControl)
{
if (caretMS <= 250)
{
//draw caret
- gfx.DrawRectangle((int)(caretPos - _textDrawOffset), 2, 2, Height - 4, UIManager.SkinTextures["ControlTextColor"]);
+ gfx.DrawRectangle((int)(caretPos - _textDrawOffset), textY, 2, caretHeight, UIManager.SkinTextures["ControlTextColor"]);
}
}
else
{
if (string.IsNullOrWhiteSpace(Text) && !string.IsNullOrWhiteSpace(_label))
{
- gfx.DrawString(_label, 2, 2, Color.Gray, _font);
+ gfx.DrawString(_label, 2, textY, Color.Gray, _font);
}
}