Skip to content

Comments

Radius Rounding Bug#153

Merged
ascibisz merged 3 commits intomainfrom
bug/radii-rounding
Nov 13, 2025
Merged

Radius Rounding Bug#153
ascibisz merged 3 commits intomainfrom
bug/radii-rounding

Conversation

@ascibisz
Copy link
Contributor

@ascibisz ascibisz commented Nov 11, 2025

Problem

Rounding was behaving weirdly when you typed in a value see ticket

Solution

Since the radius is converted from micrometers in the input field to voxels in the recipe JSON, we getting some floats back with a lot of figures after the decimal point. Simply clamping the number of figures and rounding seemed to fix the problem.

I also added type="number", which just prevents people from entering non-numbers into the little input box next to the slider

@ascibisz ascibisz marked this pull request as ready for review November 11, 2025 18:17
@ascibisz ascibisz requested review from meganrm and rugeli November 11, 2025 18:17
@github-actions
Copy link

github-actions bot commented Nov 11, 2025

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 20.26% 366 / 1806
🔵 Statements 20.26% 366 / 1806
🔵 Functions 41.37% 24 / 58
🔵 Branches 71.68% 81 / 113
File Coverage
File Stmts % Branch % Funcs % Lines Uncovered Lines
Changed Files
src/components/InputSwitch/index.tsx 0% 0% 0% 0% 1-2, 9-11, 27-28, 30-33, 37, 40-42, 44-55, 58, 61-63, 65-68, 70-74, 76-82, 84-110, 112, 114-133, 135, 137-144, 146, 148, 150-162, 164-166, 168
Generated in workflow #151

@github-actions
Copy link

github-actions bot commented Nov 11, 2025

PR Preview Action v1.6.2
Preview removed because the pull request was closed.
2025-11-13 18:59 UTC

Copy link
Contributor

@rugeli rugeli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Screenshot 2025-11-11 at 11 31 02 AM looks like the tooltip in the screenshot is still a bit off, should we tweak the formatting?(I'll add a comment at the spot)

style={{ margin: "0 6px" }}
value={numericValue}
onChange={handleInputChange}
type="number"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
type="number"
type="number"
tooltip={{ formatter: (value) => value?.toFixed(2) }}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this line actually meant for the Slider, rather than the InputNumber?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the root of the issue here is that we're rounding off the values, but not the maxValues, so we're getting an issue where we're trying to allow the user to input the max of 0.16199999999, but then we round that to 0.162 which is above the max.

I'll add the same rounding to the maxValue and that will solve this issue!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice fix! just tested again and it worked well!

@ascibisz ascibisz requested a review from interim17 November 12, 2025 17:59
@ascibisz ascibisz merged commit d19f438 into main Nov 13, 2025
2 checks passed
@ascibisz ascibisz deleted the bug/radii-rounding branch November 13, 2025 18:59
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.

3 participants