UXP Slider change on move

Does anyone know if it’s possible to get a spectrum slider to update on the value change as it slides before mouse up?

Currently I have a slider that changes values, but it only runs the function after the mouse button is released, not as the value changes.

Calling the code with

document.querySelector("#//siderId").addEventListener(“change”, //functionName);

Thanks

Have you tried the input event instead of the change event?
But be aware, that if you tie that together with Photoshop operations, it might cause some problems or delay (while the mouse is pressed down, or if the operation takes long to process):

I tried input first, doesn’t seem respond to the change, change works as expected but you can only see the effect on mouse up. the mouseup event is the same behaviour as change but seems to miss the changes occasionally.

For note it’s just changing the opacity of a layer so near zero processing

That’s enough; if you’re doing anything to the PS canvas, PS will not update while the mouse button is down. This causes input and change to appear to act very similarly, although they are doing very different things. If you have some other value in your panel’s UI that is updating on input, you’ll notice that as you drag, the value is consistently updated in your panel UI. PS just isn’t currently extending that to the rest of the PS interface.

So, there are a couple flags you can include in your BatchPlay object to help with this. I’m not sure if they will fix your exact problem, but it fixed it for me.

Where you typically will have the “synchronousExecution” attribute, change it to the following:

        "synchronousExecution": true,
        "modalBehavior": "execute",
        "paintOptions": {
            "immediateUpdate": true,
            "quality": "draft" }

The “paintOptions” values specify that you want draft quality and that it should immediately update. Honestly, I just add these to everything because PS can be so finicky with its rendering at times!

Hope it helps!

   "paintOptions": {
        "immediateUpdate": true,
        "quality": "draft"
      }

Hi, where is that coming from, please ? I’ve never seen these anywhere…