Merge pull request #110 from ibs0d/claude/camera-group-keyboard-shortcuts-YaGM0

feat: add keyboard shortcuts 1-9, 0 to switch camera groups
This commit is contained in:
ibs0d 2026-03-22 21:41:46 +11:00 committed by GitHub
commit aa762a5ff7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -65,6 +65,29 @@ function Live() {
return false;
});
useKeyboardListener(
["1", "2", "3", "4", "5", "6", "7", "8", "9", "0"],
(key, modifiers) => {
if (!modifiers.down || !config || selectedCameraName) {
return false;
}
const groups = Object.entries(config.camera_groups).sort(
(a, b) => a[1].order - b[1].order,
);
// 1-9 → индексы 0-8, 0 → индекс 9
const index = key === "0" ? 9 : parseInt(key) - 1;
if (index < groups.length) {
setCameraGroup(groups[index][0]);
return true;
}
return false;
},
);
// document title
useEffect(() => {