question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

On release slider event?

See original GitHub issue

I would like to have access to a on_mouse_release event for a IntSlider, while still having continuous_update=True.

I am slicing through a 3D data cube with ipyvolume and using a slider to control the z coordinate of the slice. Updating the slice and its colors every single step of the way slows down the performance quite a lot. Screenshot at 2019-11-29 11-36-49

I would like to do something similar to what Paraview does, where while I interact with the slider, I am only moving an outline (in red on my figure) of the slice, and once I relase the slider, then update the position of the real slice and its colors. Moving the outline is very cheap.

Hence I still need to have the slider move the outline (update_outline()) in continuous_update but then trigger another function (update_slice()) once I relase the mouse button.

I tried playing around with linking a first slider in continuous_update=True to a second slider in continuous_update=False which would then trigger the update_slice(), but linking the values means that the second slider still considers every step to be a value change and triggers update_slice() every time.

I would basically need to have something like

sl = IntSlider(min=0, max=nz-1, continuous_update=True)
sl.observe(update_outline, names="value")
sl.on_mouse_release(update_slice, names="value")

I found in the documentation that you can send more than just the value to the observer function. Apparently, setting names and type to All should capture all events, and maybe there is something I could use in there, but I have not been successful in trying to use this. When I tried

sl = IntSlider(min=0, max=nz-1, continuous_update=True)
sl.observe(update_outline, names="All", type="All")

nothing happens, the function update_outline is never called (I had a print statement also in that function which never prints).

I tried to look around the documentation and the web for an example of using names="All", type="All" but found nothing.

Any help is very much appreciated!

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:12 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
davidbrochartcommented, Jan 6, 2020

I can look into implementing a “debounce” pattern. While talking with @martinRenou, it could be useful to have it on both sides:

  • in the front-end, because it is where “time is real”, reducing communications with the kernel.
  • in the back-end, where “time is not real” because communications may arrive through a slow network, reducing potentially heavy computations.
0reactions
betolinkcommented, Jul 26, 2020

related to this, somebody mentioned the continuous_update parameter and in my case it waits to send the events until the user stops dragging the slider but it sends all the changes! not just the last one, is there a way to prevent this or that’s the expected behaviour?

EDIT: nevermind, I just need to access the new value but still the whole chain of old values is sent to the kernel and resulted in a lot of traffic so I had to increase NotebookApp.iopub_data_rate_limit. It would be a good idea to implement what you guys already started talking about or even better have a “mute” property so some events are not sent as a whole if there is heavy interaction in the front end.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to fire a "change" event when the user releases the range ...
You can click and hold down on the slider knob, then move your cursor vertically outside the slider's area, and release the mouse....
Read more >
What is the best way to make range slider update only on ...
I was wondering what is currently the best way to update from an Inputs.range slider only on 'release' of the slider?
Read more >
Events and callbacks - noUiSlider - Refreshless.com
This event is similar to the 'change' events on regular <input> elements. It fires when a user stops sliding, when a slider value...
Read more >
Event Slider - EventON
Event Slider ; Latest Version 2.0.5 ; Release Date May 26th, 2016 ; Last Updated 2021-12-3.
Read more >
Slider events - jQuery Mobile Docs
slidestart triggered when there's an initial interaction with the slider. Includes drags and taps. $( ".selector" ).on( 'slidestart', function( event ) { ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found