diff options
Diffstat (limited to 'scene/gui')
-rw-r--r-- | scene/gui/button.cpp | 8 | ||||
-rw-r--r-- | scene/gui/dialogs.cpp | 4 | ||||
-rw-r--r-- | scene/gui/item_list.cpp | 1 | ||||
-rw-r--r-- | scene/gui/label.cpp | 13 | ||||
-rw-r--r-- | scene/gui/slider.cpp | 8 | ||||
-rw-r--r-- | scene/gui/text_edit.cpp | 6 | ||||
-rw-r--r-- | scene/gui/tree.cpp | 3 |
7 files changed, 26 insertions, 17 deletions
diff --git a/scene/gui/button.cpp b/scene/gui/button.cpp index 6b3e89af6c..ca4c255855 100644 --- a/scene/gui/button.cpp +++ b/scene/gui/button.cpp @@ -174,17 +174,17 @@ void Button::_notification(int p_what) { _size.width -= get_constant("hseparation") + icon_ofs_region; if (!clip_text) _size.width -= get_font("font")->get_string_size(xl_text).width; - float icon_width = icon->get_width() * _size.height / icon->get_height(); + float icon_width = _icon->get_width() * _size.height / _icon->get_height(); float icon_height = _size.height; if (icon_width > _size.width) { icon_width = _size.width; - icon_height = icon->get_height() * icon_width / icon->get_width(); + icon_height = _icon->get_height() * icon_width / _icon->get_width(); } icon_region = Rect2(style->get_offset() + Point2(icon_ofs_region, (_size.height - icon_height) / 2), Size2(icon_width, icon_height)); } else { - icon_region = Rect2(style->get_offset() + Point2(icon_ofs_region, Math::floor((valign - _icon->get_height()) / 2.0)), icon->get_size()); + icon_region = Rect2(style->get_offset() + Point2(icon_ofs_region, Math::floor((valign - _icon->get_height()) / 2.0)), _icon->get_size()); } } @@ -221,7 +221,7 @@ void Button::_notification(int p_what) { font->draw(ci, text_ofs.floor(), xl_text, color, clip_text ? text_clip : -1); if (!_icon.is_null() && icon_region.size.width > 0) { - draw_texture_rect_region(_icon, icon_region, Rect2(Point2(), icon->get_size()), color_icon); + draw_texture_rect_region(_icon, icon_region, Rect2(Point2(), _icon->get_size()), color_icon); } } break; } diff --git a/scene/gui/dialogs.cpp b/scene/gui/dialogs.cpp index 19bac5e5ac..a1b584bad6 100644 --- a/scene/gui/dialogs.cpp +++ b/scene/gui/dialogs.cpp @@ -246,8 +246,8 @@ void WindowDialog::_notification(int p_what) { } break; case NOTIFICATION_POPUP_HIDE: { - if (get_tree() && Engine::get_singleton()->is_editor_hint() && EditorNode::get_singleton()) - EditorNode::get_singleton()->dim_editor(was_editor_dimmed); + if (get_tree() && Engine::get_singleton()->is_editor_hint() && EditorNode::get_singleton() && !was_editor_dimmed) + EditorNode::get_singleton()->dim_editor(false); } break; #endif } diff --git a/scene/gui/item_list.cpp b/scene/gui/item_list.cpp index 1a0539effa..1406586361 100644 --- a/scene/gui/item_list.cpp +++ b/scene/gui/item_list.cpp @@ -411,6 +411,7 @@ void ItemList::set_max_columns(int p_amount) { ERR_FAIL_COND(p_amount < 0); max_columns = p_amount; update(); + shape_changed = true; } int ItemList::get_max_columns() const { diff --git a/scene/gui/label.cpp b/scene/gui/label.cpp index 4edd4b8530..9e2cd9e941 100644 --- a/scene/gui/label.cpp +++ b/scene/gui/label.cpp @@ -296,8 +296,9 @@ Size2 Label::get_minimum_size() const { Size2 min_style = get_stylebox("normal")->get_minimum_size(); // don't want to mutable everything - if (word_cache_dirty) + if (word_cache_dirty) { const_cast<Label *>(this)->regenerate_word_cache(); + } if (autowrap) return Size2(1, clip ? 1 : minsize.height) + min_style; @@ -377,8 +378,14 @@ void Label::regenerate_word_cache() { memdelete(current); } - Ref<StyleBox> style = get_stylebox("normal"); - int width = autowrap ? (get_size().width - style->get_minimum_size().width) : get_longest_line_width(); + int width; + if (autowrap) { + Ref<StyleBox> style = get_stylebox("normal"); + width = MAX(get_size().width, get_custom_minimum_size().width) - style->get_minimum_size().width; + } else { + width = get_longest_line_width(); + } + Ref<Font> font = get_font("font"); int current_word_size = 0; diff --git a/scene/gui/slider.cpp b/scene/gui/slider.cpp index 9f853cf0c8..ba57be1686 100644 --- a/scene/gui/slider.cpp +++ b/scene/gui/slider.cpp @@ -101,26 +101,26 @@ void Slider::_gui_input(Ref<InputEvent> p_event) { if (!mm.is_valid() && !mb.is_valid()) { - if (p_event->is_action("ui_left") && p_event->is_pressed()) { + if (p_event->is_action_pressed("ui_left", true)) { if (orientation != HORIZONTAL) return; set_value(get_value() - (custom_step >= 0 ? custom_step : get_step())); accept_event(); - } else if (p_event->is_action("ui_right") && p_event->is_pressed()) { + } else if (p_event->is_action_pressed("ui_right", true)) { if (orientation != HORIZONTAL) return; set_value(get_value() + (custom_step >= 0 ? custom_step : get_step())); accept_event(); - } else if (p_event->is_action("ui_up") && p_event->is_pressed()) { + } else if (p_event->is_action_pressed("ui_up", true)) { if (orientation != VERTICAL) return; set_value(get_value() + (custom_step >= 0 ? custom_step : get_step())); accept_event(); - } else if (p_event->is_action("ui_down") && p_event->is_pressed()) { + } else if (p_event->is_action_pressed("ui_down", true)) { if (orientation != VERTICAL) return; diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index 5e6e038f38..8ddc31745e 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -3928,7 +3928,9 @@ void TextEdit::_base_insert_text(int p_line, int p_char, const String &p_text, i if (shift_first_line) { text.set_breakpoint(p_line + 1, text.is_breakpoint(p_line)); text.set_hidden(p_line + 1, text.is_hidden(p_line)); - text.set_info_icon(p_line + 1, text.get_info_icon(p_line), text.get_info(p_line)); + if (text.has_info_icon(p_line)) { + text.set_info_icon(p_line + 1, text.get_info_icon(p_line), text.get_info(p_line)); + } text.set_breakpoint(p_line, false); text.set_hidden(p_line, false); @@ -4583,7 +4585,7 @@ void TextEdit::_scroll_moved(double p_to_val) { int v_scroll_i = floor(get_v_scroll()); int sc = 0; int n_line; - for (n_line = 0; n_line < text.size() - 1; n_line++) { + for (n_line = 0; n_line < text.size(); n_line++) { if (!is_line_hidden(n_line)) { sc++; sc += times_line_wraps(n_line); diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp index e064b9f913..a44b42a467 100644 --- a/scene/gui/tree.cpp +++ b/scene/gui/tree.cpp @@ -1234,7 +1234,7 @@ int Tree::draw_item(const Point2i &p_pos, const Point2 &p_draw_ofs, const Size2 } } - if (select_mode != SELECT_ROW && (p_item->cells[i].selected || selected_item == p_item)) { + if ((select_mode == SELECT_ROW && selected_item == p_item) || p_item->cells[i].selected) { Rect2i r(cell_rect.position, cell_rect.size); if (p_item->cells[i].text.size() > 0) { @@ -2765,7 +2765,6 @@ bool Tree::edit_selected() { return false; Rect2 rect = s->get_meta("__focus_rect"); - popup_edited_item = s; popup_edited_item_col = col; |