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

Slider cannot move one step at a time if the range is large #248

Open
zhangcx93 opened this issue Mar 23, 2023 · 3 comments
Open

Slider cannot move one step at a time if the range is large #248

zhangcx93 opened this issue Mar 23, 2023 · 3 comments

Comments

@zhangcx93
Copy link

I use PlutoUI’s Slider to observe my experiment log, total length is more than 10 thousands, and want to watch the dynamics of each step one at a time. I used to use arrow keys after clicked the slider, everything was good.
But right now, maybe after some version update, one click of arrow key would move the step by N, so the same for mousemove, and i cannot find any settings to make it one at a time.

How can i move one step at a time in PlutoUI’s Slider? This function is very neccessary.

This simple code can reproduce this problem.
@bind test_num Slider(1:10000, show_value=true)
with 10000 length, it move 10 at a time not 1.

@fonsp
Copy link
Member

fonsp commented Mar 23, 2023

Hi @zhangcx93 ! That's a good question!

As a workaround, you can use @bind test_num HTML("<input type=range min=1 max=10000>") to get a classical slider that isn't affected by #219

@zhangcx93
Copy link
Author

@fonsp Thanks for the workaround.
but it's pretty strange to me that a slider which should have few number states(like start, end, step, and currentvalue), would take much memory if the length is too large. and a downsample method is needed to fix that.
did some part of the code tried to iterate or collect the range?

@wilsongoode
Copy link
Contributor

@zhangcx93 You should be able to use the max_steps parameter for the Slider as below:
@bind test_num Slider(1:10000, show_value=true, max_steps=10_000)

I think max_steps will work for arbitrarily-many steps, though you may eventually run into the performance issues that prompted the addition of that parameter.

For reference, this line in src/Builtins.jl contains a default max_steps=1_000.

@fonsp Any thoughts/preferences on how this parameter could be better communicated?

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

3 participants