mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-05 02:51:49 +00:00
fix: TextBox.setCaret fails when font is not ready
This commit is contained in:
parent
db7ab76b7e
commit
78de9c39d8
1 changed files with 3 additions and 1 deletions
|
|
@ -640,8 +640,10 @@ size_t TextBox::getCaret() const {
|
|||
|
||||
void TextBox::setCaret(size_t position) {
|
||||
this->caret = std::min(static_cast<size_t>(position), input.length());
|
||||
if (font == nullptr) {
|
||||
return;
|
||||
}
|
||||
caretLastMove = Window::time();
|
||||
|
||||
int width = label->getSize().x;
|
||||
uint line = label->getLineByTextIndex(caret);
|
||||
int offset = label->getLineYOffset(line) + contentOffset().y;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue