diff options
author | Jummit <jummit@web.de> | 2022-10-09 11:17:10 +0200 |
---|---|---|
committer | Jummit <jummit@web.de> | 2022-10-09 18:42:54 +0200 |
commit | a6c1cfae9965cea01864060ae8cfbe39ee00af11 (patch) | |
tree | f70f7ab2048bf1d45d11f199b8a22a812ff12a23 /scene | |
parent | 880a0177d12463b612268afe95bd3d8dd565bf52 (diff) |
Allow drag-clicking before symbol lookup
This makes it easier for touch and tablet users to do symbol lookups in
the code editor.
Diffstat (limited to 'scene')
-rw-r--r-- | scene/gui/code_edit.cpp | 5 | ||||
-rw-r--r-- | scene/gui/code_edit.h | 1 |
2 files changed, 4 insertions, 2 deletions
diff --git a/scene/gui/code_edit.cpp b/scene/gui/code_edit.cpp index 70707dba11..3f4d366e05 100644 --- a/scene/gui/code_edit.cpp +++ b/scene/gui/code_edit.cpp @@ -371,12 +371,13 @@ void CodeEdit::gui_input(const Ref<InputEvent> &p_gui_input) { } if (symbol_lookup_on_click_enabled) { - if (mm->is_command_or_control_pressed() && mm->get_button_mask() == MouseButton::NONE && !is_dragging_cursor()) { + if (mm->is_command_or_control_pressed() && mm->get_button_mask() == MouseButton::NONE) { + symbol_lookup_pos = get_line_column_at_pos(mpos); symbol_lookup_new_word = get_word_at_pos(mpos); if (symbol_lookup_new_word != symbol_lookup_word) { emit_signal(SNAME("symbol_validate"), symbol_lookup_new_word); } - } else { + } else if (!mm->is_command_or_control_pressed() || (mm->get_button_mask() != MouseButton::NONE && symbol_lookup_pos != get_line_column_at_pos(mpos))) { set_symbol_lookup_word_as_valid(false); } } diff --git a/scene/gui/code_edit.h b/scene/gui/code_edit.h index 09c7ef80bf..8e35dcec22 100644 --- a/scene/gui/code_edit.h +++ b/scene/gui/code_edit.h @@ -235,6 +235,7 @@ private: String symbol_lookup_new_word = ""; String symbol_lookup_word = ""; + Point2i symbol_lookup_pos; /* Visual */ Ref<StyleBox> style_normal; |