From 648130420672e62e24d1fb2b7f248b7de411b74a Mon Sep 17 00:00:00 2001 From: itsmattkc Date: Wed, 14 Apr 2021 10:13:45 +1000 Subject: [PATCH] node: set ignore node when positioning and shifting recursively --- app/node/node.cpp | 3 ++- app/node/node.h | 10 +++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/app/node/node.cpp b/app/node/node.cpp index d52d8893e..f087111d1 100644 --- a/app/node/node.cpp +++ b/app/node/node.cpp @@ -2294,7 +2294,7 @@ void NodeSetPositionAndShiftSurroundingsCommand::redo() // Start moving other nodes foreach (Node* surrounding, node_->parent()->nodes()) { - if (bounding_rect.contains(surrounding->GetPosition()) && surrounding != node_) { + if (bounding_rect.contains(surrounding->GetPosition()) && surrounding != node_ && surrounding != ignore_node_) { QPointF new_pos = surrounding->GetPosition(); qreal move_rate = 0.50; @@ -2306,6 +2306,7 @@ void NodeSetPositionAndShiftSurroundingsCommand::redo() new_pos.setY(new_pos.y() + move_rate); auto sur_command = new NodeSetPositionAndShiftSurroundingsCommand(surrounding, new_pos, true); + sur_command->SetIgnoreNode(node_); sur_command->redo(); commands_.append(sur_command); } diff --git a/app/node/node.h b/app/node/node.h index fb9ecf7cf..e7fdc1361 100644 --- a/app/node/node.h +++ b/app/node/node.h @@ -1351,7 +1351,8 @@ public: NodeSetPositionAndShiftSurroundingsCommand(Node* node, const QPointF& pos, bool move_dependencies_relatively) : node_(node), position_(pos), - move_dependencies_(move_dependencies_relatively) + move_dependencies_(move_dependencies_relatively), + ignore_node_(nullptr) {} virtual ~NodeSetPositionAndShiftSurroundingsCommand() override @@ -1373,6 +1374,11 @@ public: } } + void SetIgnoreNode(Node* n) + { + ignore_node_ = n; + } + private: Node* node_; @@ -1382,6 +1388,8 @@ private: QVector commands_; + Node* ignore_node_; + }; class NodeSetPositionAsChildCommand : public UndoCommand