From a664c399ffbfbcbe4e8565f18df4ad394611056f Mon Sep 17 00:00:00 2001 From: "Sylvain Rager (regar42)" Date: Sun, 14 Jan 2018 18:00:45 +0100 Subject: [PATCH] Fix when path is drawn or before being animated * Fix maze edition when path is drawn * Clear the path before animating it --- src/ui/MazeDrawing.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ui/MazeDrawing.java b/src/ui/MazeDrawing.java index 3fd2874..16c1fd6 100644 --- a/src/ui/MazeDrawing.java +++ b/src/ui/MazeDrawing.java @@ -178,6 +178,7 @@ public final class MazeDrawing extends JPanel implements MouseListener { JOptionPane.showMessageDialog(this, "Click on the maze to see the shortest path evolve"); pathCounter = 0; + repaint(); } for (VertexInterface vertex : shortestPath) { @@ -204,7 +205,7 @@ public final class MazeDrawing extends JPanel implements MouseListener { public void mouseClicked(MouseEvent e) { int boxRow = getBoxRow(e.getX()); int boxLine = getBoxLine(e.getY()); - if (mazeApp.isPathDrawn() == 0) { + if (mazeApp.isPathDrawn() != 1) { // Don't do anything if there is no box where the mouse is if (boxRow >= mazeApp.getModelDimensionX() || boxLine >= mazeApp.getModelDimensionY()) {