Skip to content

Commit

Permalink
GH-752 Restrict arrow-key movement to only selected elements
Browse files Browse the repository at this point in the history
  • Loading branch information
Naros committed Aug 16, 2024
1 parent 1953283 commit 781a057
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/editor/graph/graph_edit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -517,12 +517,16 @@ void OrchestratorGraphEdit::_move_selected(const Vector2& p_delta)
{
for (int i = 0; i < get_child_count(); i++)
{
if (OrchestratorGraphNode* node = Object::cast_to<OrchestratorGraphNode>(get_child(i)))
GraphElement* element = Object::cast_to<GraphElement>(get_child(i));
if (!element || !element->is_selected())
continue;

if (OrchestratorGraphNode* node = Object::cast_to<OrchestratorGraphNode>(element))
{
node->set_position_offset(node->get_position_offset() + p_delta);
node->get_script_node()->set_position(node->get_position_offset());
}
else if (OrchestratorGraphKnot* knot = Object::cast_to<OrchestratorGraphKnot>(get_child(i)))
else if (OrchestratorGraphKnot* knot = Object::cast_to<OrchestratorGraphKnot>(element))
{
knot->set_position_offset(knot->get_knot()->point + p_delta);
}
Expand Down

0 comments on commit 781a057

Please sign in to comment.