I’m trying to write a plugin that changes & keeps track of the brush size. I can get
‘set’ events when the brush size is changed, however no event is fired when I change the brush size with the bracket keys [ and ]. The only thing I can think of doing for this is to listen for those key presses, however I don’t understand what type of event I should be looking for, or frankly what function to use.
Mutation observer probably won’t help you, because it observes changes in the HTML DOM.
Keypresses are not Photoshop events, so you won’t be able to see them with Ps listener. They can be listened to with keydown JS event, but I very much doubt you will be able to intercept the host event (if it even produces one) in your panel. I believe, you could catch this event only if your panel is in focus
That’s probably for the best. I don’t really want to track keypresses anyway as that would be an unreliable way to track brush size, since someone could reassign the keybinding. I’m more so confused why there is no event fired when the brush size is changed via pressing the bracket keys and was hoping that tracking the key press would be a workaround. Is performing a simple get for brush parameters every, say, 1/4 to 1/2 a second going to cause noticeable performance issues in PS?
can’t tell the impact without testing.
but logically this solution seems like an overkill for such a simple task.
one plugin doing a non-blocking pull can be accepted. but as a practice this is very undesirable and can lead to a slower user experience.