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 14, 2020
1 parent 00acb0d commit 18b60bc
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 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 @@ -305,6 +298,7 @@ public void draw(Graphics2D g, int posx, int posy, int width, int height) {
movenum--;
}
if (curMovenum > 0) {
Font origFont = g.getFont();
g.setColor(Color.WHITE);
Font f = new Font("", Font.BOLD, 15);
g.setFont(f);
Expand All @@ -315,9 +309,21 @@ public void draw(Graphics2D g, int posx, int posy, int width, int height) {
+ height / 2
- (int) (convertScoreMean(curCurscoreMean) * height / 2 / maxcoreMean)
+ 2 * DOT_RADIUS);
g.setFont(origFont);
}
}

// Show move number
int moveNumber = curMove.getData().moveNumber;
String moveNumString = "" + moveNumber;
movenum = moveNumber - 1;
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 18b60bc

Please sign in to comment.