diff options
Diffstat (limited to 'scene/gui')
| -rw-r--r-- | scene/gui/base_button.cpp | 7 | ||||
| -rw-r--r-- | scene/gui/rich_text_label.cpp | 2 | ||||
| -rw-r--r-- | scene/gui/text_edit.cpp | 8 | ||||
| -rw-r--r-- | scene/gui/view_panner.cpp | 11 | ||||
| -rw-r--r-- | scene/gui/view_panner.h | 3 |
5 files changed, 23 insertions, 8 deletions
diff --git a/scene/gui/base_button.cpp b/scene/gui/base_button.cpp index bcb2b0c50e..5f937acb8d 100644 --- a/scene/gui/base_button.cpp +++ b/scene/gui/base_button.cpp @@ -382,8 +382,11 @@ Ref<ButtonGroup> BaseButton::get_button_group() const { } void BaseButton::set_shortcut_context(Node *p_node) { - ERR_FAIL_NULL_MSG(p_node, "Shortcut context node can't be null."); - shortcut_context = p_node->get_instance_id(); + if (p_node != nullptr) { + shortcut_context = p_node->get_instance_id(); + } else { + shortcut_context = ObjectID(); + } } Node *BaseButton::get_shortcut_context() const { diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp index e9d346f943..bc386e9813 100644 --- a/scene/gui/rich_text_label.cpp +++ b/scene/gui/rich_text_label.cpp @@ -3154,7 +3154,7 @@ void RichTextLabel::append_text(const String &p_bbcode) { indent_level++; push_list(indent_level, LIST_NUMBERS, false); pos = brk_end + 1; - tag_stack.push_front(tag); + tag_stack.push_front("ol"); } else if (tag == "ol type=a") { indent_level++; push_list(indent_level, LIST_LETTERS, false); diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index fe1aaab557..7db1fae2b6 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -650,7 +650,7 @@ void TextEdit::_notification(int p_what) { } } - bool draw_placeholder = text[0].length() == 0; + bool draw_placeholder = text.size() == 1 && text[0].length() == 0; // Get the highlighted words. String highlighted_text = get_selected_text(); @@ -6020,7 +6020,7 @@ void TextEdit::_update_scrollbars() { h_scroll->set_begin(Point2(0, size.height - hmin.height)); h_scroll->set_end(Point2(size.width - vmin.width, size.height)); - bool draw_placeholder = text[0].length() == 0; + bool draw_placeholder = text.size() == 1 && text[0].length() == 0; int visible_rows = get_visible_line_count(); int total_rows = draw_placeholder ? placeholder_wraped_rows.size() - 1 : get_total_visible_line_count(); @@ -6101,7 +6101,7 @@ void TextEdit::_scroll_moved(double p_to_val) { } if (v_scroll->is_visible_in_tree()) { // Set line ofs and wrap ofs. - bool draw_placeholder = text[0].length() == 0; + bool draw_placeholder = text.size() == 1 && text[0].length() == 0; int v_scroll_i = floor(get_v_scroll()); int sc = 0; @@ -6116,7 +6116,7 @@ void TextEdit::_scroll_moved(double p_to_val) { } } n_line = MIN(n_line, text.size() - 1); - int line_wrap_amount = (text[0].length() == 0) ? placeholder_wraped_rows.size() - 1 : get_line_wrap_count(n_line); + int line_wrap_amount = draw_placeholder ? placeholder_wraped_rows.size() - 1 : get_line_wrap_count(n_line); int wi = line_wrap_amount - (sc - v_scroll_i - 1); wi = CLAMP(wi, 0, line_wrap_amount); diff --git a/scene/gui/view_panner.cpp b/scene/gui/view_panner.cpp index 7476887877..71865b4864 100644 --- a/scene/gui/view_panner.cpp +++ b/scene/gui/view_panner.cpp @@ -81,7 +81,12 @@ bool ViewPanner::gui_input(const Ref<InputEvent> &p_event, Rect2 p_canvas_rect) return false; } - if (mb->get_button_index() == MouseButton::MIDDLE || (enable_rmb && mb->get_button_index() == MouseButton::RIGHT) || (!simple_panning_enabled && mb->get_button_index() == MouseButton::LEFT && is_panning())) { + bool is_drag_event = mb->get_button_index() == MouseButton::MIDDLE || + (enable_rmb && mb->get_button_index() == MouseButton::RIGHT) || + (!simple_panning_enabled && mb->get_button_index() == MouseButton::LEFT && is_panning()) || + (force_drag && mb->get_button_index() == MouseButton::LEFT); + + if (is_drag_event) { if (mb->is_pressed()) { is_dragging = true; } else { @@ -166,6 +171,10 @@ bool ViewPanner::is_panning() const { return is_dragging || pan_key_pressed; } +void ViewPanner::set_force_drag(bool p_force) { + force_drag = p_force; +} + ViewPanner::ViewPanner() { Array inputs; inputs.append(InputEventKey::create_reference(Key::SPACE)); diff --git a/scene/gui/view_panner.h b/scene/gui/view_panner.h index 8423c2a1c0..5b820c5f8f 100644 --- a/scene/gui/view_panner.h +++ b/scene/gui/view_panner.h @@ -48,6 +48,8 @@ public: private: bool is_dragging = false; bool pan_key_pressed = false; + bool force_drag = false; + bool enable_rmb = false; bool simple_panning_enabled = false; @@ -70,6 +72,7 @@ public: void setup(ControlScheme p_scheme, Ref<Shortcut> p_shortcut, bool p_simple_panning); bool is_panning() const; + void set_force_drag(bool p_force); bool gui_input(const Ref<InputEvent> &p_ev, Rect2 p_canvas_rect = Rect2()); void release_pan_key(); |
