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

Fix +/- buttons on float sliders not working at certain values #3865

Merged
merged 1 commit into from
Feb 2, 2024

Conversation

jbodner09
Copy link
Contributor

@jbodner09 jbodner09 commented Jan 16, 2024

When the value stored internally was slightly greater than the intended value, the +/- buttons were working fine. Like, 0.99 was stored internally as something like 0.99000081, so truncating it to 2 decimal places would work as intended. However, when the value stored internally was slightly less than the intended value, the stringstream truncation was being too aggressive. For example, when going from 1.00 to 1.01, 1.01 is stored internally as something like 1.009999999902. Thus, when trying to truncate to only two decimal places, the stringstream would see "1.00" and happily just store it as one, making it appear as though the button click did absolutely nothing (because it ended up in fact doing absolutely nothing!) Adding an extra order of magnitude of precision fixes this case. How I managed to only test with values that were stored slightly higher internally is 🥖 on me.

Build Artifacts

@garrettjoecox garrettjoecox merged commit f8b0e58 into HarbourMasters:develop Feb 2, 2024
8 checks passed
@jbodner09 jbodner09 deleted the button-fix branch February 3, 2024 02:05
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.

5 participants