Fix TextFieldElement

This commit is contained in:
MrLetsplay 2023-10-16 17:31:12 +02:00
parent fabcf3cbef
commit b087ccad1e
Signed by: mr
SSH Key Fingerprint: SHA256:92jBH80vpXyaZHjaIl47pjRq+Yt7XGTArqQg1V7hSqg

View File

@ -263,6 +263,7 @@ UIElementType TextFieldElement::getType() {
void TextFieldElement::focusEnter() { void TextFieldElement::focusEnter() {
cursor->visible = true; cursor->visible = true;
lastCharTyped = glfwGetTime();
capture = Input::captureKeyboardInput( capture = Input::captureKeyboardInput(
KeyCharCallback([](KeyCharEvent event, void *data) { KeyCharCallback([](KeyCharEvent event, void *data) {
@ -337,8 +338,8 @@ void TextFieldElement::draw(UIPoint screenPos, glm::mat4 projection) {
} }
void TextFieldElement::setText(std::string text) { void TextFieldElement::setText(std::string text) {
this->text = text; this->cursorPos = 0;
this->textElement->setText(text); updateText(Unicode::convertStdToU32(text));
} }
} }