GLMakie: Run a function when slider is released

Quite a simple question: Is it possible to run a function specifically when a slider is released?

A way to check whether the slider is currently being dragged would suffice. I couldn’t find a way to do this.

I think it should be possible.

Looking at here we have the function initialize_block! for a Slider, which seems to do the setup.

There are some functions like onmouseleftXXX which seems like what we would want, and we could define the same mouseevent they use there for onmouseleftup.

So I think something along the way

sl = Slider(...)
mouseevents = addmouseevents!(sl.blockscene, sl.layoutobservables.computedbbox)
onmouseleftup(mouseevents) do event
    # Your mouse release code

should work, though for me this didn’t seem to get all the way. Have to run now, so thought I would just put it here if someone wanted to look into it further.

1 Like

Thanks for the answer. I also cannot get this to work as intended. It seems to only work when the scene is clicked and released without being dragged. I also tried onmouseleftdragstop but I can only get this to work very unreliable, I don’t really understand when it works.

There’s this open PR for it Add option to update when releasing mouse button from slide by lwhitefox · Pull Request #2228 · MakieOrg/Makie.jl · GitHub