This commit is contained in:
Jade (Rose) Rowland 2024-12-30 23:19:37 -05:00
parent 974376d404
commit 08f6c1ad5e
4 changed files with 29 additions and 2 deletions

View file

@ -649,7 +649,7 @@ export const always = register('always', function (func, pat) {
* @memberof Pattern
* @returns Pattern
* @example
* * s("bd(5,8)").onKey("Control:j", x => x.segment(16).color("red")).onKey("Control:i", x => x.fast(2).color("blue"))
* s("bd(5,8)").onKey("Control:j", x => x.segment(16).color("red")).onKey("Control:i", x => x.fast(2).color("blue"))
*/
export const onKey = register('onKey', function (input, func, pat) {

View file

@ -438,6 +438,9 @@ let keyState;
export function getCurrentKeyboardState() {
if (keyState == null) {
if (typeof window === 'undefined') {
return;
}
keyState = {};
// Listen for the keydown event to mark the key as pressed
window.addEventListener('keydown', (event) => {