added new auto-positioning to place block command

This commit is contained in:
itsmattkc
2021-03-14 22:09:59 +11:00
parent 82d6daa3da
commit 056a1202d6
3 changed files with 57 additions and 0 deletions
+31
View File
@@ -1395,6 +1395,37 @@ private:
};
class NodeSetPositionToOffsetOfAnotherNodeCommand : public UndoCommand
{
public:
NodeSetPositionToOffsetOfAnotherNodeCommand(Node* node, Node* other_node, const QPointF& offset) :
node_(node),
other_node_(other_node),
offset_(offset)
{}
virtual Project * GetRelevantProject() const override
{
return node_->project();
}
virtual void redo() override
{
node_->SetPosition(other_node_->GetPosition() + offset_);
}
virtual void undo() override
{
node_->SetPosition(other_node_->GetPosition() - offset_);
}
private:
Node* node_;
Node* other_node_;
QPointF offset_;
};
}
#endif // NODE_H