}
GridElement selectedElement = grid.getElementByPoint(evt.getPoint(), puzzlePanel.getSize());
if (selectedElement != null) {
if (selectedElement instanceof Edge) {
undoStack.push(new EdgeCommand((Edge) selectedElement));
undoStack.peek().execute();
}
if (grid.editMode() && selectedElement instanceof Cell) {
((Cell) selectedElement).setNextValue();
}