From c1a5eeac5b21c5b2a0261fbf0cd05d7750d07b18 Mon Sep 17 00:00:00 2001 From: Drulikar Date: Tue, 25 Jun 2024 17:53:53 -0700 Subject: [PATCH 1/2] Fix crash on lookup when filtered --- tgui/packages/tgui/interfaces/KeyBinds.jsx | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/tgui/packages/tgui/interfaces/KeyBinds.jsx b/tgui/packages/tgui/interfaces/KeyBinds.jsx index 3022d3077d3b..b09a36e67dae 100644 --- a/tgui/packages/tgui/interfaces/KeyBinds.jsx +++ b/tgui/packages/tgui/interfaces/KeyBinds.jsx @@ -92,10 +92,16 @@ export const KeyBinds = (props) => { if (!targetEntry) { return; } - // If a keybind was found, scroll to the first match. - document - .getElementById(targetEntry[0]) - .scrollIntoView(); + // If a keybind was found, scroll to the first match currently rendered. + for (let i = 0; i < targetEntry.length; i++) { + const element = document.getElementById( + targetEntry[i], + ); + if (element) { + element.scrollIntoView(); + break; + } + } }} /> From 92f6dabe76519b9a22663b3ff91a1658465975df Mon Sep 17 00:00:00 2001 From: Drulikar Date: Tue, 25 Jun 2024 17:54:17 -0700 Subject: [PATCH 2/2] Fix/add key mappings --- code/_globalvars/lists/client.dm | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/code/_globalvars/lists/client.dm b/code/_globalvars/lists/client.dm index 78f3a20da424..404e8a662e80 100644 --- a/code/_globalvars/lists/client.dm +++ b/code/_globalvars/lists/client.dm @@ -6,20 +6,42 @@ GLOBAL_LIST_EMPTY(keybindings_by_name) // This is a mapping from JS keys to Byond - ref: https://keycode.info/ GLOBAL_LIST_INIT(_kbMap, list( "UP" = "North", + "ARROWUP" = "North", "RIGHT" = "East", + "ARROWRIGHT" = "East", "DOWN" = "South", + "ARROWDOWN" = "South", "LEFT" = "West", + "ARROWLEFT" = "West", "INSERT" = "Insert", "HOME" = "Northwest", "PAGEUP" = "Northeast", - "DEL" = "Delete", + "DEL" = "Delete", // Unlikely this is correct now + "DELETE" = "Delete", "END" = "Southwest", "PAGEDOWN" = "Southeast", "SPACEBAR" = "Space", "ENTER" = "Return", "ALT" = "Alt", "SHIFT" = "Shift", - "CONTROL" = "Ctrl" + "CONTROL" = "Ctrl", + "MULTIPLY" = "Multiply", + "DIVIDE" = "Divide", + "SUBTRACT" = "Subtract", + "ADD" = "Add", + "DECIMAL" = "Decimal", + "CLEAR" = "Center", + "PAUSE" = "Pause", + "CONTEXTMENU" = "Apps", + "NUMLOCK" = "Numlock", + "SCROLLLOCK" = "Scroll", + "MEDIANEXTTRACK" = "MediaNext", + "MEDIAPLAYPAUSE" = "MediaPlayPause", + "MEDIASTOP" = "MediaStop", + "MEDIAPREVIOUSTRACK" = "MediaPrev", + "VOLUMEMUTE" = "VolumeMute", + "VOLUMEUP" = "VolumeUp", + "VOLUMEDOWN" = "VolumeDown", )) ///List of ckeys that have seen a blurb of a given key.