summaryrefslogtreecommitdiffstats
path: root/editor/plugins/canvas_item_editor_plugin.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2024-01-08 11:56:19 +0100
committerRémi Verschelde <rverschelde@gmail.com>2024-01-08 11:56:19 +0100
commitf46465ba1462c573812ed01f8adf000cf71d595c (patch)
treee83bc8d11595c6967bcc2a169a942ba2003f5baf /editor/plugins/canvas_item_editor_plugin.cpp
parentc10d268974744dadb454154d1ad78209735b7ccd (diff)
parentff03a32323ef87291c996e39ca0aadcb17646e9c (diff)
downloadredot-engine-f46465ba1462c573812ed01f8adf000cf71d595c.tar.gz
Merge pull request #86804 from ryevdokimov/allow-all-modes-to-select
Allow all editor modes to select nodes in the viewport
Diffstat (limited to 'editor/plugins/canvas_item_editor_plugin.cpp')
-rw-r--r--editor/plugins/canvas_item_editor_plugin.cpp19
1 files changed, 10 insertions, 9 deletions
diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp
index 8dbf67a37a..3c68b2c4ed 100644
--- a/editor/plugins/canvas_item_editor_plugin.cpp
+++ b/editor/plugins/canvas_item_editor_plugin.cpp
@@ -2014,14 +2014,14 @@ bool CanvasItemEditor::_gui_input_move(const Ref<InputEvent> &p_event) {
if ((b->is_alt_pressed() && !b->is_command_or_control_pressed()) || tool == TOOL_MOVE) {
List<CanvasItem *> selection = _get_edited_canvas_items();
- drag_selection.clear();
- for (int i = 0; i < selection.size(); i++) {
- if (_is_node_movable(selection[i], true)) {
- drag_selection.push_back(selection[i]);
+ if (selection.size() > 0) {
+ drag_selection.clear();
+ for (int i = 0; i < selection.size(); i++) {
+ if (_is_node_movable(selection[i], true)) {
+ drag_selection.push_back(selection[i]);
+ }
}
- }
- if (selection.size() > 0) {
drag_type = DRAG_MOVE;
CanvasItem *ci = selection[0];
@@ -2043,8 +2043,9 @@ bool CanvasItemEditor::_gui_input_move(const Ref<InputEvent> &p_event) {
drag_from = transform.affine_inverse().xform(b->get_position());
_save_canvas_item_state(drag_selection);
+
+ return true;
}
- return true;
}
}
}
@@ -2344,7 +2345,7 @@ bool CanvasItemEditor::_gui_input_select(const Ref<InputEvent> &p_event) {
return true;
}
- if (b.is_valid() && b->get_button_index() == MouseButton::LEFT && b->is_pressed() && tool == TOOL_SELECT && !panner->is_panning()) {
+ if (b.is_valid() && b->get_button_index() == MouseButton::LEFT && b->is_pressed() && !panner->is_panning() && (tool == TOOL_SELECT || tool == TOOL_MOVE || tool == TOOL_SCALE || tool == TOOL_ROTATE)) {
// Single item selection
Point2 click = transform.affine_inverse().xform(b->get_position());
@@ -2379,7 +2380,7 @@ bool CanvasItemEditor::_gui_input_select(const Ref<InputEvent> &p_event) {
} else {
bool still_selected = _select_click_on_item(ci, click, b->is_shift_pressed());
// Start dragging
- if (still_selected) {
+ if (still_selected && (tool == TOOL_SELECT || tool == TOOL_MOVE)) {
// Drag the node(s) if requested
drag_start_origin = click;
drag_type = DRAG_QUEUED;