};
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_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);