Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix hotkeys menu crash + New/Fixed keybind support #6565

Merged
merged 3 commits into from
Jun 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 24 additions & 2 deletions code/_globalvars/lists/client.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
14 changes: 10 additions & 4 deletions tgui/packages/tgui/interfaces/KeyBinds.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
}}
/>
</Flex.Item>
Expand Down
Loading