feat: add arrow key navigation to calculator sample
This commit is contained in:
@@ -316,6 +316,17 @@ function handleKeyboard(event) {
|
||||
'%': 'mod',
|
||||
'^': 'pow',
|
||||
};
|
||||
const arrowMap = {
|
||||
ArrowUp: upButton,
|
||||
ArrowDown: downButton,
|
||||
ArrowLeft: leftButton,
|
||||
ArrowRight: rightButton,
|
||||
};
|
||||
if (arrowMap[key]) {
|
||||
event.preventDefault();
|
||||
arrowMap[key].click();
|
||||
return;
|
||||
}
|
||||
if (map[key]) {
|
||||
event.preventDefault();
|
||||
execute(map[key]);
|
||||
|
||||
Reference in New Issue
Block a user