-
-
Notifications
You must be signed in to change notification settings - Fork 657
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Inverted Connects for unconstrained behavior #1272
Conversation
This implementation allows connects to invert when handles pass each other in unconstrained behavior. Added possibility to manually update connects via updateOptions without having to destroy and recreate the slider (which would lose the drag). Also added invertConnects to the API for more control. Set behavior to "unconstrained-invert-connects" to enable this feature.
@leongersen Implemented the changes into nouislider.ts and added documentation. |
Thanks for your PR, as well as your sponsorship, I appreciate it. I'm having a spin at testing this right now. An issue I'm running into is that this logic does not fully account for more than two handles. You'll see what I mean if you set the start values in the added documentation to I'm having a look to see if I can get that in. |
Yea, I was thinking about it supporting more than 2 handles, but came to the conclusion that it really doesn't make sense to use this outside of 2 handles. Couldn't think of a usecase. If someone really needs two ranges overlapping from end to start, they can just implement two sliders for it. Maybe you can add a commit to limit it to 2 handles or just a note in the documentation. Update: All of that just to support something that probably noone will ever use makes no sense to put the extra work in it. It would also unnecessarily bloat the size of the module. |
I came to the same conclusion; this is a nice feature and there is not much of a use case of trying to implement this for sliders with more than two handles. I'm making some changes:
|
Changes sound good! Thanks so much for your help to implement this 🤩 |
I've merged this and released noUiSlider 15.8.0. Thank you for contributing! https://refreshless.com/nouislider/behaviour-option/#section-invert-connects |
Here's an implementation idea for feature request #1262
I had a similar request for a slider which selects a yearly season range, which also had to cover overlaps over December-January.
The only way to achieve this was to destroy and recreate the slider with inverted connects when an overlap happens, but that destroyed the slider drag focus aswell, so you can never get the sliders past each other.
So I had to write my own patch adding a new behavior
"invert-connects"
which can be used like that:I also made it possible to manually control inverting connects with the added API
invertConnects
or updating any connects options viaupdateOptions
.This patch is IE9 compatible!