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

Let sliders in number widget support floating point numbers #35

Merged
merged 2 commits into from
Jun 5, 2018

Conversation

imagejan
Copy link
Member

@imagejan imagejan commented Feb 15, 2018

This allows to use non-integer step sizes and ranges in script parameters with style="slider" (see #31).

#@ Integer (style="slider", min=0, max=100, stepSize=2) a
#@ Double (style="slider", min=0, max=100, stepSize=1.5) b
#@ Double (style="slider", min=0, max=100, stepSize=20) c
#@ Double (style="slider", min=0, max=1, stepSize=0.1) d
#@ Double (style="slider", min=-10, max=5, stepSize=5) e
#@ Double (style="slider", min=-0.03, max=0.05, stepSize=0.001) f

image

Remaining issues:

  • the preferred width of the sliders messes up the alignment and squeezes the text fields too much
  • scroll bars still only support integers
  • sometimes I noticed strange behavior of the slider when range << 1 and trying to adjust the value; it seems to snap to 0 (may be related to Spinner increment/decrement precision problem #19)

@imagejan
Copy link
Member Author

I fixed the remaining issues by:

  • setting a default preferred size for spinners in the widget
  • applying the same logic as for sliders to scroll bars (private nested class CalibratedScrollBar)
  • fixing a few instances where getValue().intValue() was used.

@ctrueden this PR is ready to be merged from my side.

@ctrueden ctrueden merged commit 96b4a3b into master Jun 5, 2018
@ctrueden ctrueden deleted the calibrated-sliders branch June 5, 2018 19:53
@ctrueden
Copy link
Member

ctrueden commented Jun 5, 2018

@imagejan You are a rock star! 🎸

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

Successfully merging this pull request may close these issues.

2 participants