Skip to content

Fix segments scaling - #142

Merged
CodeZeno merged 1 commit into
CodeZeno:mainfrom
zpqrtbnk:fix-segments-scaling
Sep 25, 2026
Merged

CodeZeno merged 1 commit into
CodeZeno:mainfrom
zpqrtbnk:fix-segments-scaling

Conversation

@zpqrtbnk

@zpqrtbnk zpqrtbnk commented Sep 24, 2026 •

Copy link
Copy Markdown

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

  • I have read CONTRIBUTING.md and CODE_OF_CONDUCT.md.
  • The change is focused and contains no credentials or sensitive data.
  • I have added or updated relevant documentation and tests, where applicable.
  • I have left changelog and version changes to maintainers unless requested.

@zpqrtbnk zpqrtbnk mentioned this pull request Sep 24, 2026
@zpqrtbnk
zpqrtbnk marked this pull request as ready for review September 24, 2026 17:52
@CodeZeno
CodeZeno force-pushed the main branch 2 times, most recently from dda0af4 to 814ff73 Compare September 25, 2026 02:25
@CodeZeno
CodeZeno force-pushed the fix-segments-scaling branch from bdd4cfb to 66088f9 Compare September 25, 2026 05:37
@CodeZeno
CodeZeno merged commit 6880f51 into CodeZeno:main Sep 25, 2026
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.

Segments scaling issue

2 participants