diff --git a/scene/gui/graph_edit.cpp b/scene/gui/graph_edit.cpp index de4c0405d3a..417da9ad167 100644 --- a/scene/gui/graph_edit.cpp +++ b/scene/gui/graph_edit.cpp @@ -811,6 +811,10 @@ void GraphEdit::_gui_input(const Ref &p_ev) { } if (mm.is_valid() && dragging) { + if (!moving_selection) { + emit_signal("_begin_node_move"); + moving_selection = true; + } just_selected = true; drag_accum += mm->get_relative(); @@ -920,16 +924,16 @@ void GraphEdit::_gui_input(const Ref &p_ev) { } if (drag_accum != Vector2()) { - - emit_signal("_begin_node_move"); - for (int i = get_child_count() - 1; i >= 0; i--) { GraphNode *gn = Object::cast_to(get_child(i)); if (gn && gn->is_selected()) gn->set_drag(false); } + } + if (moving_selection) { emit_signal("_end_node_move"); + moving_selection = false; } dragging = false; diff --git a/scene/gui/graph_edit.h b/scene/gui/graph_edit.h index 08f75e90ea6..7b810a42343 100644 --- a/scene/gui/graph_edit.h +++ b/scene/gui/graph_edit.h @@ -98,6 +98,7 @@ private: bool dragging; bool just_selected; + bool moving_selection; Vector2 drag_accum; float zoom;