Setting text box input no longer involves repeatedly setting it each frame
This commit is contained in:
parent
8c11141ac5
commit
e1e93b8a31
14 changed files with 271 additions and 212 deletions
|
|
@ -94,7 +94,9 @@ struct UpdateInputData {
|
|||
std::optional<std::string> textOut;
|
||||
} clipboard;
|
||||
|
||||
std::function<void(std::shared_ptr<RichText::TextBox>, std::shared_ptr<RichText::TextBox::Cursor>)> richTextBoxEdit;
|
||||
std::shared_ptr<RichText::TextBox> previousRichTextBoxToEdit;
|
||||
std::shared_ptr<RichText::TextBox> richTextBoxToEdit;
|
||||
std::shared_ptr<RichText::TextBox::Cursor> richTextBoxToEditCursor;
|
||||
|
||||
SkFont get_font(float fSize) const;
|
||||
|
||||
|
|
|
|||
|
|
@ -31,7 +31,8 @@ template <typename T> class TextBox : public Element {
|
|||
}) {
|
||||
selection.update(Clay_Hovered(), io.mouse.leftClick, io.mouse.leftHeld);
|
||||
if(data && selection.selected) {
|
||||
io.richTextBoxEdit(textbox, cur);
|
||||
io.richTextBoxToEdit = textbox;
|
||||
io.richTextBoxToEditCursor = cur;
|
||||
textbox->process_mouse_left_button(*cur, io.mouse.pos - bb.min, io.mouse.leftClick, io.mouse.leftHeld, io.key.leftShift);
|
||||
if((updateEveryEdit && textbox->inputChangedTextBox) || io.key.enter) {
|
||||
update_on_edit();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue