fix resolved path drawing after background

- resolved path should be dran after background, else it is not visible.
This commit is contained in:
philippe lhardy
2020-12-13 23:04:19 +01:00
parent 338dc3dd6b
commit 14b6d9ff1d

View File

@@ -303,28 +303,6 @@ public class MazeComponent
mY = map.getHeight(); mY = map.getHeight();
} }
if ((sX == gX) && (sY == gY)) {
g.setColor(colorMap.goal);
} else {
g.setColor(colorMap.resolved_path);
cp.drawDot(g, new Position(gX, gY), pX, pY, mX, mY);
g.setColor(colorMap.path);
}
cp.drawDot(g, new Position(sX, sY), pX, pY, mX, mY);
synchronized (lockChange) {
g.setColor(colorMap.goal);
if (current != null) {
cp.drawDot(g, current, pX, pY, mX, mY);
}
if (solvedPath != null) {
for (DirectionPosition resolved : solvedPath) {
// cp.drawDot(g, resolved.getPosition(), pX, pY, mX, mY);
cp.drawPath(g, resolved, pX, pY, mX, mY);
}
}
}
int aX = pX; int aX = pX;
int aY = pY; int aY = pY;
@@ -344,6 +322,16 @@ public class MazeComponent
} }
} }
if ((sX == gX) && (sY == gY)) {
g.setColor(colorMap.goal);
} else {
g.setColor(colorMap.resolved_path);
cp.drawDot(g, new Position(gX, gY), pX, pY, mX, mY);
g.setColor(colorMap.path);
}
cp.drawDot(g, new Position(sX, sY), pX, pY, mX, mY);
pX = aX;
pY = aY; pY = aY;
// draw all walls within clip bounds horiz first then lines // draw all walls within clip bounds horiz first then lines
@@ -355,6 +343,22 @@ public class MazeComponent
} }
} }
pX = aX;
pY = aY;
synchronized (lockChange) {
g.setColor(colorMap.goal);
if (current != null) {
cp.drawDot(g, current, pX, pY, mX, mY);
}
if (solvedPath != null) {
for (DirectionPosition resolved : solvedPath) {
// cp.drawDot(g, resolved.getPosition(), pX, pY, mX, mY);
cp.drawPath(g, resolved, pX, pY, mX, mY);
}
}
}
if (this.showAll) { if (this.showAll) {
statusListener.addStatus("*"); statusListener.addStatus("*");
pX = aX; pX = aX;