Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Hiraoka committed Jan 31, 2021
2 parents 4ac11e0 + 8b35323 commit 8e905a5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/main/java/featurecat/lizzie/gui/BoardPane.java
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ public class BoardPane extends LizziePane {

private long lastAutosaveTime = System.currentTimeMillis();
private boolean isReplayVariation = false;
private boolean isPonderingBeforeReplayVariation = false;

LizzieMain owner;
/** Creates a window */
Expand Down Expand Up @@ -568,6 +569,7 @@ public void replayBranch(boolean generateGif) {
int height = this.getHeight();
int oriBranchLength = boardRenderer.getDisplayedBranchLength();
isReplayVariation = true;
isPonderingBeforeReplayVariation = Lizzie.leelaz.isPondering();
if (Lizzie.leelaz.isPondering()) Lizzie.leelaz.togglePonder();
Runnable runnable =
new Runnable() {
Expand Down Expand Up @@ -595,7 +597,8 @@ public void run() {
}
boardRenderer.setDisplayedBranchLength(oriBranchLength);
isReplayVariation = false;
if (!Lizzie.leelaz.isPondering()) Lizzie.leelaz.togglePonder();
if (isPonderingBeforeReplayVariation && !Lizzie.leelaz.isPondering())
Lizzie.leelaz.togglePonder();
}
};
Thread thread = new Thread(runnable);
Expand Down
5 changes: 4 additions & 1 deletion src/main/java/featurecat/lizzie/gui/LizzieFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ public class LizzieFrame extends MainFrame {

private long lastAutosaveTime = System.currentTimeMillis();
private boolean isReplayVariation = false;
private boolean isPonderingBeforeReplayVariation = false;

// Display Comment
private HTMLDocument htmlDoc;
Expand Down Expand Up @@ -1432,6 +1433,7 @@ public void replayBranch(boolean generateGif) {
if (replaySteps <= 0) return; // Bad steps or no branch
int oriBranchLength = boardRenderer.getDisplayedBranchLength();
isReplayVariation = true;
isPonderingBeforeReplayVariation = Lizzie.leelaz.isPondering();
if (Lizzie.leelaz.isPondering()) Lizzie.leelaz.togglePonder();
Runnable runnable =
new Runnable() {
Expand All @@ -1449,7 +1451,8 @@ public void run() {
}
Utils.setDisplayedBranchLength(boardRenderer, oriBranchLength);
isReplayVariation = false;
if (!Lizzie.leelaz.isPondering()) Lizzie.leelaz.togglePonder();
if (isPonderingBeforeReplayVariation && !Lizzie.leelaz.isPondering())
Lizzie.leelaz.togglePonder();
}
};
Thread thread = new Thread(runnable);
Expand Down

0 comments on commit 8e905a5

Please sign in to comment.