From 8b35323257fda520f576bd4638300c01c43c050b Mon Sep 17 00:00:00 2001 From: Hiraoka Date: Sun, 31 Jan 2021 20:07:47 +0900 Subject: [PATCH] Keep pondering on/off after animation by "r" key (#852) --- src/main/java/featurecat/lizzie/gui/BoardPane.java | 5 ++++- src/main/java/featurecat/lizzie/gui/LizzieFrame.java | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main/java/featurecat/lizzie/gui/BoardPane.java b/src/main/java/featurecat/lizzie/gui/BoardPane.java index 4abd47f85..151216b46 100644 --- a/src/main/java/featurecat/lizzie/gui/BoardPane.java +++ b/src/main/java/featurecat/lizzie/gui/BoardPane.java @@ -92,6 +92,7 @@ public class BoardPane extends LizziePane { private long lastAutosaveTime = System.currentTimeMillis(); private boolean isReplayVariation = false; + private boolean isPonderingBeforeReplayVariation = false; LizzieMain owner; /** Creates a window */ @@ -547,6 +548,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() { @@ -574,7 +576,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); diff --git a/src/main/java/featurecat/lizzie/gui/LizzieFrame.java b/src/main/java/featurecat/lizzie/gui/LizzieFrame.java index 434828245..863f663a1 100644 --- a/src/main/java/featurecat/lizzie/gui/LizzieFrame.java +++ b/src/main/java/featurecat/lizzie/gui/LizzieFrame.java @@ -102,6 +102,7 @@ public class LizzieFrame extends MainFrame { private long lastAutosaveTime = System.currentTimeMillis(); private boolean isReplayVariation = false; + private boolean isPonderingBeforeReplayVariation = false; // Display Comment private HTMLDocument htmlDoc; @@ -1406,6 +1407,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() { @@ -1423,7 +1425,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);