Skip to content
This repository has been archived by the owner on Mar 19, 2024. It is now read-only.

Commit

Permalink
Add Z key
Browse files Browse the repository at this point in the history
  • Loading branch information
Reqwey committed Nov 16, 2022
1 parent 66c9389 commit 6d9294c
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -590,15 +590,24 @@ function gameJoin(username) {
$(document).bind('keydown', (event) => {
// var leftDist = appContainer.offsetLeft, topDist = appContainer.offsetTop
if (!window.selectedTd) return
if (event.which === 69) {
if (event.which === 90) { // Z to half
if (window.selectedTd.half) {
window.selectedTd.half = false
$(`#td${window.selectedTd.x}-${window.selectedTd.y}`).html(window.selectedTd.unit)
} else {
window.selectedTd.half = true
window.selectedTd.unit = $td.html()
$td.html(`50%`)
}
} else if (event.which === 69) { // E to pop_back
let route = window.queue.pop_back()
if (route) {
$(`#td${window.selectedTd.x}-${window.selectedTd.y}`).removeClass(`selected`)
window.selectedTd.x = route.from.x;
window.selectedTd.y = route.from.y;
$(`#td${window.selectedTd.x}-${window.selectedTd.y}`).addClass(`selected`)
}
} else if (event.which === 81) {
} else if (event.which === 81) { // Q to clear
let route = window.queue.front()
if (route) {
window.queue.clear()
Expand Down

0 comments on commit 6d9294c

Please sign in to comment.