Skip to content

Commit 2bb8330

Browse files
zmothpaceholder
authored andcommitted
Improve Delete Command
1 parent b147ba0 commit 2bb8330

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/UndoCommands.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,10 @@ DeleteCommand(BasicGraphicsScene* scene)
234234
}
235235
}
236236

237+
// If nothing is deleted, cancel this operation
238+
if(connJsonArray.isEmpty() && nodesJsonArray.isEmpty())
239+
setObsolete(true);
240+
237241
_sceneJson["nodes"] = nodesJsonArray;
238242
_sceneJson["connections"] = connJsonArray;
239243
}
@@ -251,9 +255,7 @@ void
251255
DeleteCommand::
252256
redo()
253257
{
254-
auto & graphModel = _scene->graphModel();
255-
256-
deleteSerializedItems(_sceneJson, graphModel);
258+
deleteSerializedItems(_sceneJson, _scene->graphModel());
257259
}
258260

259261

0 commit comments

Comments
 (0)