Skip to content

Commit

Permalink
Draw movenum in front of winrate curve (featurecat#808)
Browse files Browse the repository at this point in the history
  • Loading branch information
Hiraoka committed Nov 8, 2020
1 parent ebeb446 commit acdb8a8
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/main/java/featurecat/lizzie/gui/WinrateGraph.java
Original file line number Diff line number Diff line change
Expand Up @@ -153,13 +153,6 @@ public void draw(Graphics2D g, int posx, int posy, int width, int height) {
g.setStroke(dashed);
g.setColor(Color.white);
g.drawLine(x, posy, x, posy + height);
// Show move number
String moveNumString = "" + node.getData().moveNumber;
int mw = g.getFontMetrics().stringWidth(moveNumString);
int margin = strokeRadius;
int mx = x - posx < width / 2 ? x + margin : x - mw - margin;
g.setColor(Color.black);
g.drawString(moveNumString, mx, posy + height - margin);
g.setStroke(previousStroke);
}
if (playouts > 0 && node.getData().moveNumber - 1 <= numMoves) {
Expand Down Expand Up @@ -318,6 +311,16 @@ public void draw(Graphics2D g, int posx, int posy, int width, int height) {
}
}

// Show move number
movenum = curMove.getData().moveNumber - 1;
String moveNumString = "" + movenum;
int x = posx + (movenum * width / numMoves);
int mw = g.getFontMetrics().stringWidth(moveNumString);
int margin = strokeRadius;
int mx = x - posx < width / 2 ? x + margin : x - mw - margin;
g.setColor(Color.black);
g.drawString(moveNumString, mx, posy + height - margin);

// record parameters for calculating moveNumber
params[0] = posx;
params[1] = posy;
Expand Down

0 comments on commit acdb8a8

Please sign in to comment.