From afedea7342f9ebf3eaa8c4a726dc46a1a9f8e9d9 Mon Sep 17 00:00:00 2001 From: itsmattkc Date: Sun, 11 Apr 2021 18:57:42 +1000 Subject: [PATCH] restore old node positioning code New code didn't work. --- app/node/node.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/app/node/node.cpp b/app/node/node.cpp index b2b02d807..1f4f4326b 100644 --- a/app/node/node.cpp +++ b/app/node/node.cpp @@ -2280,18 +2280,21 @@ void NodeSetPositionAndShiftSurroundingsCommand::redo() commands_.append(set_pos_command); // Get bounding rect - QRectF bounding_rect(position_.x() - 0.45, position_.y() - 0.45, 0.9, 0.9); + QRectF bounding_rect(position_.x() - 0.5, position_.y() - 0.5, 1, 1); // Start moving other nodes foreach (Node* surrounding, node_->parent()->nodes()) { if (bounding_rect.contains(surrounding->GetPosition()) && surrounding != node_) { QPointF new_pos = surrounding->GetPosition(); - if (surrounding->GetPosition().y() > position_.y()) { - new_pos.setY(new_pos.y() + 0.5); - } else { - new_pos.setY(new_pos.y() - 0.5); + + qreal move_rate = 0.50; + + if (surrounding->GetPosition().y() < position_.y()) { + move_rate = -move_rate; } + new_pos.setY(new_pos.y() + move_rate); + auto sur_command = new NodeSetPositionAndShiftSurroundingsCommand(surrounding, new_pos, true); sur_command->redo(); commands_.append(sur_command);