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

Sliders and scroll bars should scale to stepSize #31

Closed
imagejan opened this issue Oct 3, 2017 · 1 comment
Closed

Sliders and scroll bars should scale to stepSize #31

imagejan opened this issue Oct 3, 2017 · 1 comment

Comments

@imagejan
Copy link
Member

imagejan commented Oct 3, 2017

When using non-integer numeric inputs with style="slider" or style="scroll bar", the UI widgets only support integer steps (because the underlying JSlider and JScrollbar objects only support int values).

This can be improved by scaling the slider range to the [min; max] range as follows:

  • slider.setMinimum(0)
  • slider.setMaximum( (max-min) / stepSize )
  • slider.setValue( (value-min) / stepSize )
  • value = slider.getValue() * stepSize + min

and setting the slider/scrollbar labels to string representations of the scaled values.

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