Merge pull request #5030 from sanikoyes/Pr-fix-label-minsize

fix line_edit&label get min size bug&draw problem
This commit is contained in:
Rémi Verschelde 2016-06-04 16:08:25 +02:00
commit f1cd33b539
2 changed files with 4 additions and 5 deletions

View file

@ -488,9 +488,9 @@ void Label::regenerate_word_cache() {
if (!autowrap) { if (!autowrap) {
minsize.width=width; minsize.width=width;
if (max_lines_visible > 0 && line_count > max_lines_visible) { if (max_lines_visible > 0 && line_count > max_lines_visible) {
minsize.height=(font->get_height()+line_spacing)*max_lines_visible; minsize.height=(font->get_height() * max_lines_visible) + (line_spacing * (max_lines_visible - 1));
} else { } else {
minsize.height=(font->get_height()+line_spacing)*line_count; minsize.height=(font->get_height() * line_count)+(line_spacing * (line_count - 1));
} }
} }

View file

@ -454,7 +454,7 @@ void LineEdit::_notification(int p_what) {
} break; } break;
} }
int ofs_max=width-style->get_minimum_size().width; int ofs_max=width-style->get_minimum_size().width+x_ofs;
int char_ofs=window_pos; int char_ofs=window_pos;
int y_area=height-style->get_minimum_size().height; int y_area=height-style->get_minimum_size().height;
@ -799,8 +799,7 @@ Size2 LineEdit::get_minimum_size() const {
Ref<Font> font=get_font("font"); Ref<Font> font=get_font("font");
Size2 min=style->get_minimum_size(); Size2 min=style->get_minimum_size();
min.height+=font->get_height(); min+=font->get_string_size(this->text);
min.width+=get_constant("minimum_spaces")*font->get_char_size(' ').x;
return min; return min;
} }