Skip to content

Commit

Permalink
fixed issue of help pausing the controller
Browse files Browse the repository at this point in the history
  • Loading branch information
ssatguru committed Oct 1, 2023
1 parent f264fa6 commit a5a5107
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
1 change: 1 addition & 0 deletions demo/tst/testCommandControl.html
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
</li>
</li>
<li><input type="checkbox" id="kb" checked class="w3-check" />enable keyboard</li>
<li><button id="pause">pause</button></li>
<li><button id="help">help</button></li>
</ui>
</div>
Expand Down
5 changes: 3 additions & 2 deletions demo/tst/testCommandControl.js
Original file line number Diff line number Diff line change
Expand Up @@ -349,16 +349,17 @@ function setControls() {
cc.enableKeyBoard(e.target.checked);
canvas.focus();
};
// document.getElementById("help").onclick = showHelp;
document.getElementById("help").onclick = showHelp;
document.getElementById("closehelp").onclick = showHelp;

let animPaused = false;
document.getElementById("help").onclick = (e) => {
document.getElementById("pause").onclick = (e) => {
if (animPaused) {
cc.resumeAnim();
} else {
cc.pauseAnim();
}
animPaused = !animPaused;
toggleClass(e);
};
}
1 change: 1 addition & 0 deletions demo/tst/testNPC.html
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
<input type="checkbox" id="toff" class="w3-check" />turning off
</li>
<li><input type="checkbox" id="kb" checked class="w3-check" />enable keyboard</li>
<li><button id="pause">pause</button></li>
<li><button id="help">help</button></li>
</ui>
</div>
Expand Down
5 changes: 3 additions & 2 deletions demo/tst/testNPC.js
Original file line number Diff line number Diff line change
Expand Up @@ -436,16 +436,17 @@ function setControls() {
cc.enableKeyBoard(e.target.checked);
canvas.focus();
};
// document.getElementById("help").onclick = showHelp;
document.getElementById("help").onclick = showHelp;
document.getElementById("closehelp").onclick = showHelp;

let animPaused = false;
document.getElementById("help").onclick = (e) => {
document.getElementById("pause").onclick = (e) => {
if (animPaused) {
cc.resumeAnim();
} else {
cc.pauseAnim();
}
animPaused = !animPaused;
toggleClass(e);
};
}

0 comments on commit a5a5107

Please sign in to comment.