-
-
Notifications
You must be signed in to change notification settings - Fork 1
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
Feature Request: Ability to enable/disable keyboard events for individual keys #5
Comments
This feature already exists. You can disable/enable individual keys. |
I see now that disable() and enable() exist and have tried them and they work for pointer-events. However, it seems like the keydown and keyup functions are missing a check to see that the keys are active, thus not preventing keydown and keyup events. |
Keydown and keyup events are handled by JZZ.input.ASCII class, those are also easy to disable. |
Would you recommend doing something like this? Or what else could I do? const ascii = JZZ.input.ASCII({
at: "piano",
Z: '60',
S: '61',
X: '62',
D: '63',
C: '64',
V: '65',
G: '66',
B: '67',
H: '68',
N: '69',
J: '70',
M: '71'
})
ascii.connect(piano)
// do something
ascii.disconnect(piano)
ascii = JZZ.input.ASCII({
at: "piano",
Z: '60',
null: '61',
X: '62',
null: '63',
C: '64',
V: '65',
null: '66',
B: '67',
null: '68',
N: '69',
null: '70',
M: '71'
})
ascii.connect(piano) |
Yes, that would work. Just remove the 'null: ...' from your code, e.g.:
Alternatively, you can insert a JZZ.Widget between the ASCII and piano and use more complicated logic control the MIDI traffic. |
Got it! Thanks! |
I understand you can disable touch and pointer events using the code below.
But I wish to enable and disable individual keyboard events from JZZ.input.ASCII as well. For example like so:
It would be useful to disable certain keys to showcase different scales and allow the user to only play those notes using their keyboard.
The text was updated successfully, but these errors were encountered: