Does anyone know how to capture the keyboard event, like “keypress” and “keyup” event in the UXP code when the user is working on the canvas? (like drawing with pencil tool or filling color with bucket tool).
I want to temporally change the current in used brush settings to a new value when a hotkey is pressed and recover it when that key is released.
And here is something I have tried and searched:
I tried the JS event like,
document.addEventListener('keypress', ()=>console.log("Key pressed!"));
But no logs recorded
Then I also checked the UXP event listener, following the tutorial page here:
Attaching Event Listeners (adobe.io)
I tried the code snippet on it but the “keypress” seems not a predefined event there. So nothing recorded
I guess the photoshop will take care all these events at a very high priority, but is it still possible for us to use any hotkey in our plugin? Thanks for any help