Fixed a cursor placement issue in GuiTextEditKeyboardPopup.

This commit is contained in:
Leon Styhre 2021-10-07 18:33:57 +02:00
parent 3669d2320c
commit 087cde4700
2 changed files with 4 additions and 4 deletions

View file

@ -133,9 +133,6 @@ GuiTextEditKeyboardPopup::GuiTextEditKeyboardPopup(
mText = std::make_shared<TextEditComponent>(mWindow);
mText->setValue(initValue);
if (!multiLine)
mText->setCursor(initValue.size());
// Header.
mGrid.setEntry(mTitle, glm::ivec2{0, 0}, false, true);
@ -289,6 +286,9 @@ GuiTextEditKeyboardPopup::GuiTextEditKeyboardPopup(
setPosition((static_cast<float>(Renderer::getScreenWidth()) - mSize.x) / 2.0f,
(static_cast<float>(Renderer::getScreenHeight()) - mSize.y) / 2.0f);
}
if (!multiLine)
mText->setCursor(initValue.size());
}
void GuiTextEditKeyboardPopup::onSizeChanged()

View file

@ -102,7 +102,7 @@ GuiTextEditPopup::GuiTextEditPopup(Window* window,
if (multiLine)
textHeight *= 6.0f;
mText->setSize(0, textHeight);
mText->setSize(0.0f, textHeight);
// Adapt width to the geometry of the display. The 1.778 aspect ratio is the 16:9 reference.
float aspectValue = 1.778f / Renderer::getScreenAspectRatio();