home
·
contact
·
privacy
projects
/
plomrogue2
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
cd0fee3
)
Move instantly on move button press, don't wait for interval to end.
author
Christian Heller
<c.heller@plomlompom.de>
Mon, 14 Dec 2020 21:19:19 +0000
(22:19 +0100)
committer
Christian Heller
<c.heller@plomlompom.de>
Mon, 14 Dec 2020 21:19:19 +0000
(22:19 +0100)
rogue_chat.html
patch
|
blob
|
history
diff --git
a/rogue_chat.html
b/rogue_chat.html
index 3f281579afa8e5dcf0edcaedcc00aad23994303d..dd8de5b783bbf835fa73d5a1b92b7c80f5901629 100644
(file)
--- a/
rogue_chat.html
+++ b/
rogue_chat.html
@@
-1801,15
+1801,17
@@
for (const move_button of document.querySelectorAll('[id*="_move_"]')) {
};
let direction = move_button.id.split('_')[2].toUpperCase();
let move_repeat;
};
let direction = move_button.id.split('_')[2].toUpperCase();
let move_repeat;
+ function move() {
+ if (tui.mode.available_actions.includes("move")) {
+ server.send(['TASK:MOVE', direction]);
+ } else if (tui.mode.available_actions.includes("move_explorer")) {
+ explorer.move(direction);
+ tui.full_refresh();
+ };
+ }
move_button.onmousedown = function() {
move_button.onmousedown = function() {
- move_repeat = window.setInterval(function() {
- if (tui.mode.available_actions.includes("move")) {
- server.send(['TASK:MOVE', direction]);
- } else if (tui.mode.available_actions.includes("move_explorer")) {
- explorer.move(direction);
- tui.full_refresh();
- };
- }, 100);
+ move();
+ move_repeat = window.setInterval(move, 100);
};
move_button.onmouseup = function() {
window.clearInterval(move_repeat);
};
move_button.onmouseup = function() {
window.clearInterval(move_repeat);