Repository navigation
Fit label bounds to text drawn at the current zoom - #369
Merged
Merged
Conversation
On screen a label draws with a font scaled to the zoom, whose hinted advances don't scale evenly, but its background and wrap width came from the text measured at full size. At 94.7% a yellow label's right padding shrank to 6 px against 10 on the left. A 36 pt label wrapped its last word out of the box. Copy and Save draw at full size, so they looked right. At other zooms, keep the line breaks from full size and size the background from the zoomed font. Clicks and selection outlines follow what's drawn. Full size draws as before, and export keeps its own bounds. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GzSMSTMRJauuo55mvixfj9
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.
At fractional zoom, labels use hinted font widths that do not scale evenly: background padding can shrink on one side and the last word can wrap outside the box. Preserve full-size line breaks while measuring the zoomed font, and use the drawn bounds for the background, hit testing and selection outline. Copy and Save keep their full-size bounds.
The test setup now lays out the canvas after loading an image. Label captures use 512-point strips with graphics-state restoration and pixel-density normalization, plus checks for white corners and bounded painted regions. This addresses the hidden-parent failure seen on macOS and avoids the large-image readback used by the failing Windows CI probes. Every original zoom, font, tolerance and behavioral assertion is retained; a new 2600-point capture check catches incomplete readback. Production source is unchanged by these two test corrections.
Validation: exact revised head
31195752dd122dfd80b3f578dd92b1cb1f3bb96apassed all nine private-display Linux label/empty-state cases with zero failures/errors/skips. Its unchanged production tree was previously tested at05a1936b1c1b82dab063f7ca1ad4e561eecdca2e: 58 focused and 358 full Linux cases, zero failures/errors and three expected full-suite skips. Mac clang syntax checks with XCTest/AppKit headers passed on this exact revised head; no local native runtime run is claimed. The same revised test file passed four offscreen render/readback cases on the Windows carry backend; the window-ordering hit/drag test was not run on that shared desktop. Hosted CI on this revision now passes in the original failing environment; the Windows cache-width explanation remains an inference. Earlier macOS and Windows on-screen checks covered the unchanged production patch; no new human screen check is claimed.CI on this exact head: all four jobs passed. Windows covered 358 cases with zero failures/errors and six expected skips, including all five label probes. macOS covered 337 cases with zero failures and one skip. Both Linux theme suites and AppImage runtime/smoke checks passed.
Known follow-up: the live editor uses the zoomed font and may wrap lines differently from the finished label.