welai / dual-range-bar

A dual range slider/scrolling bar without dependencies
https://welai.github.io/dual-range-bar
MIT License
14 stars 1 forks source link

Adding Stride parameter to addRangeChangeCallback #3

Open ghost opened 5 years ago

ghost commented 5 years ago

Hi,

It would be convenient to add a stride parameter to callback functions, especially when we execute lot of code inside them.

Example:

var stride = 50;
horizontalBar.addLowerRangeChangeCallback(function(val) { heavycode(); }, stride);

Can we achieve this kind of behavior without editing the library ?

Thanks.

celestialphineas commented 5 years ago

Hi, thank you for your suggestion. Again, this is a crazily ill-designed libaray. I've taken your advice under consideration, but I'm not sure how much time I could spend on re-write this project (working on it, and of course, the API will change a lot, for the callbacks are very bad practices).

dual-range-bar is designed to work as a scroll bar for a canvas (Demo: GridCanvas). If what you are looking for is a mature implementation for a range slider, here are some of the better choices:

Unfortunately, there is no easy way to achieve the behavior you want without modifications to its source code as far as I know (about my crazy spaghetti codes...). Just be bold to fork your version. It's under MIT license.

Feel free to keep this issue either open or close before I am about to draft a release of the refactored code in the future.