Fix segments scaling - #142
Merged
Merged
Conversation
Closed
zpqrtbnk
marked this pull request as ready for review
September 24, 2026 17:52
CodeZeno
force-pushed
the
main
branch
2 times, most recently
from
September 25, 2026 02:25
dda0af4 to
814ff73
Compare
CodeZeno
force-pushed
the
fix-segments-scaling
branch
from
September 25, 2026 05:37
bdd4cfb to
66088f9
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR should fix #140.
I have reviewed the code changes.
I have tested locally and it works and fixes the issue.
Warning
I am not a seasoned Windows UI / Rust developer, and so I have used Claude's help in order to diagnose the issue, and then to propose a fix. I have reviewed the code manually, made manual tweaks, and think it makes enough sense.
Summary
See issue #140.
Root cause: positions are correct on average, but each segment and gap has to snap to whole pixels, and the leftover fractions build up unevenly. Especially, at 150%, segments all 15, but gaps switch between 2 and 1. And on a 12–15 px segment, one pixel is about 7–8%, which is easy to see.
What the PR does: Round both the segment and the gap, then let the bar's total width differ slightly from 109 × scale. At 150% that's 15 × 10 + 2 × 9 = 168 px instead of 164. That means changing the layout, because the percentage text is positioned from the same width expression.
Testing
Run on a 150% scaling display, verify that segments are balanced.
Checklist