You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Which is capturing when the Ctrl or Shift key pressed by itself (not a part of a combination like Ctrl+S).
But the callback for controlleftcontrolright does not trigger like suggested in the example above (never logs that text to console). Tested both ff and chrome
But, say the switch above is changed to put the Ctrl both in the key codes and in the modifiers. That means we might have to match it using Ctrl+ControlLeft instead of just ControlLeft.
But then, when you throw the Shift key into the controls, and the user is mashing the keys in a desperate manner, a Ctrl keydown followed by Shift keydown (before the Ctrl keyup) might be seen as Ctrl+Shift+LeftShift, which will not match Shift+LeftShift
tl;dr Do you foresee any option to treat modifier keys as normal keys (to avoid the complications above)? Maybe separate use_raw_hotkeys! that gives the key codes without pre-processing the modifiers
The text was updated successfully, but these errors were encountered:
friendlymatthew
changed the title
no detection of modifier keys pressed by themselves: ControlLeft, ControlRight, ShiftLeft, ShiftRight
Raw Hotkeys
Jun 11, 2024
Hello
I'm trying to achieve this example
leptos-hotkeys/examples/ssr-demo/src/app.rs
Line 63 in 9143458
Which is capturing when the Ctrl or Shift key pressed by itself (not a part of a combination like Ctrl+S).
But the callback for
controlleft
controlright
does not trigger like suggested in the example above (never logs that text to console). Tested both ff and chromeI see this switch
leptos-hotkeys/leptos_hotkeys/src/hotkey.rs
Line 47 in 9143458
It seems the key is only pushed to the thing if it's not a modifier.
This means we cannot capture events if only key pressed is modifier.
Which means we can't implement tetris:
Shift and C are to hold. Ctrl and Z are to rotate 90° counterclockwise
But, say the switch above is changed to put the Ctrl both in the key codes and in the modifiers. That means we might have to match it using
Ctrl+ControlLeft
instead of justControlLeft
.But then, when you throw the Shift key into the controls, and the user is mashing the keys in a desperate manner, a Ctrl keydown followed by Shift keydown (before the Ctrl keyup) might be seen as
Ctrl+Shift+LeftShift
, which will not matchShift+LeftShift
tl;dr Do you foresee any option to treat modifier keys as normal keys (to avoid the complications above)? Maybe separate
use_raw_hotkeys!
that gives the key codes without pre-processing the modifiersThe text was updated successfully, but these errors were encountered: