diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2017-07-24 23:05:05 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-24 23:05:05 +0200 |
commit | bf8119f966666f1f3c0db2e182439714994b7163 (patch) | |
tree | f685f4c8a48b81eff897317a4153ed3d262a39e4 /scene | |
parent | 4b3fd599515bbfc459946e535a499035b6bfa217 (diff) | |
parent | 85bade0c8550c2b527f61df2577c2d88bac44c99 (diff) |
Merge pull request #9746 from Noshyaar/label
Label: add auto_height
Diffstat (limited to 'scene')
-rw-r--r-- | scene/gui/label.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/scene/gui/label.cpp b/scene/gui/label.cpp index 159d81eb09..589ba9e538 100644 --- a/scene/gui/label.cpp +++ b/scene/gui/label.cpp @@ -28,8 +28,8 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ #include "label.h" -#include "project_settings.h" #include "print_string.h" +#include "project_settings.h" #include "translation.h" void Label::set_autowrap(bool p_autowrap) { @@ -292,7 +292,7 @@ void Label::_notification(int p_what) { Size2 Label::get_minimum_size() const { if (autowrap) - return Size2(1, 1); + return Size2(1, clip ? 1 : minsize.height); else { // don't want to mutable everything @@ -487,13 +487,13 @@ void Label::regenerate_word_cache() { } } - if (!autowrap) { + if (!autowrap) minsize.width = width; - if (max_lines_visible > 0 && line_count > max_lines_visible) { - minsize.height = (font->get_height() * max_lines_visible) + (line_spacing * (max_lines_visible - 1)); - } else { - minsize.height = (font->get_height() * line_count) + (line_spacing * (line_count - 1)); - } + + if (max_lines_visible > 0 && line_count > max_lines_visible) { + minsize.height = (font->get_height() * max_lines_visible) + (line_spacing * (max_lines_visible - 1)); + } else { + minsize.height = (font->get_height() * line_count) + (line_spacing * (line_count - 1)); } word_cache_dirty = false; |