From a77069a63489b7d62a9a0cdc09039bc493aada9a Mon Sep 17 00:00:00 2001 From: Sergey Stepanov Date: Thu, 23 Nov 2023 01:36:14 +0300 Subject: [PATCH] Add L2, R2, L3, R3 mappings to keyboard --- web/css/main.css | 2 +- web/index.html | 8 ++++---- web/js/input/keyboard.js | 4 ++++ web/js/settings/settings.js | 12 ++++++++---- 4 files changed, 17 insertions(+), 9 deletions(-) diff --git a/web/css/main.css b/web/css/main.css index 5efbf8750..b47047fbc 100644 --- a/web/css/main.css +++ b/web/css/main.css @@ -91,7 +91,7 @@ body { color: #979797; font-size: 8px; top: 269px; - left: 68px; + left: 30px; position: absolute; user-select: none; diff --git a/web/index.html b/web/index.html index e082abdee..a912d4439 100644 --- a/web/index.html +++ b/web/index.html @@ -15,7 +15,7 @@ - + Cloud Retro @@ -48,7 +48,7 @@
- Arrows (move), ZXCVAS (game ABXYLR), 1/2 (1st/2nd player), Shift/Enter/K/L (select/start/save/load), F (fullscreen), share (copy shared link to the clipboard) + Arrows (move), ZXCVAS;'./ (game ABXYL1-L3R1-R3), 1/2 (1st/2nd player), Shift/Enter/K/L (select/start/save/load), F (fullscreen), share (copy the link to the clipboard)
@@ -123,7 +123,7 @@

Options

- + @@ -137,7 +137,7 @@

Options

- + diff --git a/web/js/input/keyboard.js b/web/js/input/keyboard.js index 91b9f548b..3a09ba9ef 100644 --- a/web/js/input/keyboard.js +++ b/web/js/input/keyboard.js @@ -16,6 +16,10 @@ const keyboard = (() => { KeyV: KEY.Y, KeyA: KEY.L, KeyS: KEY.R, + Semicolon: KEY.L2, + Quote: KEY.R2, + Period: KEY.L3, + Slash: KEY.R3, Enter: KEY.START, ShiftLeft: KEY.SELECT, // non-game diff --git a/web/js/settings/settings.js b/web/js/settings/settings.js index e3be8e81b..81b38c0c0 100644 --- a/web/js/settings/settings.js +++ b/web/js/settings/settings.js @@ -15,7 +15,7 @@ */ const settings = (() => { // internal structure version - const revision = 1.1; + const revision = 1.2; // default settings // keep them for revert to defaults option @@ -123,6 +123,7 @@ const settings = (() => { return { get, + clear: () => localStorage.removeItem(root), set, remove, save, @@ -164,12 +165,15 @@ const settings = (() => { } const init = () => { + // try to load settings from the localStorage with fallback to null-object provider = localStorageProvider(store) || voidProvider(store); provider.loadSettings(); - if (revision > store.settings._version) { - // !to handle this with migrations - log.warn(`Your settings are in older format (v${store.settings._version})`); + const lastRev = (store.settings || {_version: 0})._version + + if (revision > lastRev) { + log.warn(`Your settings are in older format (v${lastRev}) and will be reset to (v${revision})!`); + _reset(); } }