Fix +/- buttons on float sliders not working at certain values #3865
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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