node: added command to remove position from context

This commit is contained in:
itsmattkc
2021-05-28 17:53:40 +10:00
parent d9e45a6818
commit f0068e8c37
2 changed files with 49 additions and 0 deletions
+20
View File
@@ -2348,4 +2348,24 @@ void NodeSetPositionToOffsetOfAnotherNodeCommand::undo()
graph->SetNodePosition(node_, relative_, old_pos_);
}
void NodeRemovePositionFromContextCommand::redo()
{
NodeGraph *graph = node_->parent();
contained_ = graph->ContextContainsNode(node_, context_);
if (contained_) {
old_pos_ = graph->GetNodePosition(node_, context_);
graph->RemoveNodePosition(node_, context_);
}
}
void NodeRemovePositionFromContextCommand::undo()
{
if (contained_) {
NodeGraph *graph = node_->parent();
graph->SetNodePosition(node_, context_, old_pos_);
}
}
}