Skip to content
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

some array values supplied to value() function are being substituted by the lowest value in the array. #138

Open
allankamau opened this issue Jul 10, 2020 · 3 comments

Comments

@allankamau
Copy link

Somehow the values supplied as an array to value() function are being replaced by the lowest value in the array.
For example if I supply [1,1,10] to the value() function, the return value of value() call is [1,1,1].

This happened in the version 1.7.1 of the d3-simple-slider and I spent over 10 hours trying to figure out why the application I am developing which relies on d3-simple-slider had changed behaviour.

I have since reverted to d3-simple-slider version 1.7.0 and all is well.

var sliderRange3=d3.sliderBottom().min(1).max(10);
...
sliderRange3.value([1,1,10]);

var val=sliderRange3.value();
console.log(val);

The value of val seems to be [1,1,1].

@allankamau allankamau changed the title some array values supplied to value() function being substituted by the lowest value in the array. some array values supplied to value() function are being substituted by the lowest value in the array. Jul 10, 2020
@johnwalley
Copy link
Owner

Hi @allankamau. Thanks for reporting this. Sorry for the inconvenience. I'll take a look at this now!

@johnwalley
Copy link
Owner

There's a few things going on here.

First up there is no explicit support for more than two handles on one slider (#124 is related).

That said, the library doesn't prevent you from specifying more than two values. I can see three ways forward:

  1. Prevent the user creating a slider with more than two values
  2. Fix it so that calling value() returns the result of calling value(value). There are other places which assume there are only two values which might still cause issues
  3. Make it so the library supports an arbitrary number of handles

Number 1 feels unfair on existing users like yourself. Number 3 would be ideal but needs some planning and time to implement.

In the meantime I wonder if the change in #139 might address your immediate issue? If you get a chance to see if it helps that would be great. I also understand if you wish to stay on 1.7.0.

@allankamau
Copy link
Author

Thank you for your swift reply.
I would also like to thank you for your nice software. I am using the three handle slider as part of a timeline player control.
I am happy to continue using d3-simple-slider version 1.7.0.
I may look into the change in #139 a little later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants