Slider behavior changed?

Lately I noticed that the slider used in my plugin won’t update when sliding to a new value instantly. Only after the mouse is up, then the UI would be updated.

If this is an intentional change, or incidently affected by other updates? I used to call a debounced update if I want to delay the UI rendering, and the current behavior of sliders gives me no chance to conduct an immidiate refersh.

Not sure if this is related to Obsidian 1.5.9 Mobile (Early access) - Obsidian

The font size slider no longer attempts to resize the interface while it is still being dragged.

Any help or suggestion would be greatly appreciated.

Apologies, didn’t think anyone was relying on this. Yes we did change the default - previously it would trigger a change event during the user’s adjustment and now it only trigger a change event when the user has “finished” and let go of the mouse.

I have considered keeping the default unchanged just in case anyone was using it, but I think the new default is a lot better both as a default value, and better for performance in general (a few configurations causes file saves for every single step of the slider change, which is bad).

We have an API for returning the previous behavior, which is the currently not yet documented setInstant(true). You may use it (however you will have to check if the function exists for backwards compat with older obsidian).

From this point on, the advice is that if you’re only applying graphical/visual elements to the UI then using the instant mode is fine, but if you’re saving data to disk (such as saving your plugin options), then it is advisable to only do it after user interaction.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.