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 number range extension #238

Conversation

JohannesWilde
Copy link
Contributor

I wanted to use a slider with values from 0 to 255 and a width of 256. This however lead to the following strange behaviour:
- The slider marker could wrapped around at approx. the center of the slider and appeared to the left of the slider [outwards].
- I could also move the slider marker to the right of the slider [outwards], while the slider value returned wrapped around to 0 [stayed positive].
These changes only affect the visuals.

…r most of the code to keep working as expected. Thus here check the upper bound only if the lower bound was not at fault.
…e current type the compiler might optimize this the same way - for C++ classes with overridden operators however this distinction might prove relevant. So, allthough it is practically irrelevant here, just keep it as a best-practice for writing code.
…. As to avoid descretization errors which would have resulted from dividing first and scaling to the new range afterwards and because floats would not have yielded any better result here, just cast to the next bigger format int32_t, which can for sure contain all results of a multiplication of two int16_t.
@ImpulseAdventure ImpulseAdventure self-assigned this Jun 8, 2020
@ImpulseAdventure ImpulseAdventure merged commit e6fba12 into ImpulseAdventure:master Jun 8, 2020
@ImpulseAdventure
Copy link
Owner

Thanks for the fixes!

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