diff options
author | hop311 <hop3114@gmail.com> | 2024-09-13 00:26:41 +0200 |
---|---|---|
committer | hop311 <hop3114@gmail.com> | 2024-09-17 22:19:57 +0200 |
commit | c26247464feabe0fbb9d6a8527b242d667faa066 (patch) | |
tree | 6dbafe4337ceb672a6e5972b0155333f73cbf262 /extension/src/openvic-extension/classes/GUILabel.cpp | |
parent | 110a6ad29fb84e4507698897e97aab3f36b24242 (diff) |
Allow tooltips to be as tall as the window + shift them to stay inside ittall-tooltip
Diffstat (limited to 'extension/src/openvic-extension/classes/GUILabel.cpp')
-rw-r--r-- | extension/src/openvic-extension/classes/GUILabel.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/extension/src/openvic-extension/classes/GUILabel.cpp b/extension/src/openvic-extension/classes/GUILabel.cpp index 4b6b1c1..7e93f01 100644 --- a/extension/src/openvic-extension/classes/GUILabel.cpp +++ b/extension/src/openvic-extension/classes/GUILabel.cpp @@ -47,6 +47,8 @@ void GUILabel::_bind_methods() { OV_BIND_METHOD(GUILabel::clear); OV_BIND_METHOD(GUILabel::get_gui_text_name); + OV_BIND_METHOD(GUILabel::force_update_lines); + OV_BIND_METHOD(GUILabel::get_text); OV_BIND_METHOD(GUILabel::set_text, { "new_text" }); @@ -57,6 +59,7 @@ void GUILabel::_bind_methods() { OV_BIND_METHOD(GUILabel::get_horizontal_alignment); OV_BIND_METHOD(GUILabel::set_horizontal_alignment, { "new_horizontal_alignment" }); + OV_BIND_METHOD(GUILabel::get_base_max_size); OV_BIND_METHOD(GUILabel::get_max_size); OV_BIND_METHOD(GUILabel::set_max_size, { "new_max_size" }); OV_BIND_METHOD(GUILabel::get_border_size); @@ -293,6 +296,11 @@ Error GUILabel::set_gui_text(GUI::Text const* new_gui_text, GFX::Font::colour_co return err; } +void GUILabel::force_update_lines() { + line_update_queued = true; + _update_lines(); +} + void GUILabel::set_text(String const& new_text) { if (text != new_text) { text = new_text; @@ -331,6 +339,10 @@ void GUILabel::set_horizontal_alignment(HorizontalAlignment new_horizontal_align } } +Size2 GUILabel::get_base_max_size() const { + return gui_text != nullptr ? Utilities::to_godot_fvec2(gui_text->get_max_size()) : Size2 {}; +} + void GUILabel::set_max_size(Size2 new_max_size) { if (max_size != new_max_size) { max_size = new_max_size; @@ -462,6 +474,10 @@ void GUILabel::_queue_line_update() { } void GUILabel::_update_lines() { + if (!line_update_queued) { + return; + } + line_update_queued = false; lines.clear(); |