Hi there,
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
What is document in your case? Because it looks like it’s a DOM document of the panel and not the Ps document. I believe you need to use UXP event listener, which accepts UXP events instead of regular keypress, keydown, etc. Of course if it supports at all such events (didn’t search TBH)
Yeah you are right, this document is not the PS doc. OK I will try to do more search on UXP event, and post anything that I find later.
BTW does anyone know any good resource for the UXP event to checkout? I just searched a little bit but seems there is no docs…
I also tried the event notify in this page Photoshop (adobe.io), but unfortunately it seems still not capture any key event.