From b3fa93889735a67002c2fbee11017f28927c7233 Mon Sep 17 00:00:00 2001 From: Ugo Finnendahl Date: Sun, 3 Nov 2024 15:29:33 +0100 Subject: [PATCH] add rest input via / --- assets/js/views/xoi/main.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/assets/js/views/xoi/main.js b/assets/js/views/xoi/main.js index 3d11aae..c00c43c 100644 --- a/assets/js/views/xoi/main.js +++ b/assets/js/views/xoi/main.js @@ -311,7 +311,10 @@ const gameinput = { } else if (e.key == "F4" || e.keyCode == 115) { e.preventDefault(); context.emit('resolve', "26"); - } + } else if (e.key == "/" || e.keyCode == 111 || e.key == "r") { + e.preventDefault(); + context.emit('resolve', -1*parseFloat(e.target.value)); + } } return { check_remove, keyhandler } @@ -594,8 +597,12 @@ const gameStateMachine = (gamestack, stack, page, computedProps) => { 1: async (input, reGet) => { // Normal Game Loop // Get Game Input - const [visit, error] = await overlayAndPop("d-gameinput", { input: input }, gamestack); - // back/delete last throw + let [visit, error] = await overlayAndPop("d-gameinput", { input: input }, gamestack); + + if (parseFloat(visit) < 0 ){ + visit = ""+(computedProps.current_toGo.value[computedProps.current_player.value * 1] - parseFloat(visit)*-1); + } + // back/delete last throw if (error != undefined) { const val = removeLastVisit(page); saveGame(page);