Fix SelectableLabel text shift with inactive strokes#8276
Draft
sjh9714 wants to merge 1 commit into
Draft
Conversation
|
Preview is being built... Preview will be available at https://egui-pr-preview.github.io/pr/8276-fix-selectable-label-stroke-jitter View snapshot changes at kitdiff |
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.
Summary
Button::atom_uiused the stroke-compensated frame margin even when an inactive frameless selectable button did not paint that stroke. With a non-zero inactive bg stroke, the text jumped when hovering and the hover frame was painted.This restores the unpainted stroke padding for the inactive/no-frame path only, and adds a kittest regression that compares the text shape position before and after hover.
Testing
PATH="$HOME/.cargo/bin:$PATH" cargo test -p egui_kittest selectable_label_text_should_not_shift_when_inactive_stroke_is_unpainted -- --nocapture(failed before the fix with[11.0 9.5]vs[12.0 9.5], passes after)PATH="$HOME/.cargo/bin:$PATH" cargo fmt --checkPATH="$HOME/.cargo/bin:$PATH" cargo test -p egui_kittest --test regression_tests(passes; two pre-existing warnings inoverride_text_color_affects_interactive_widgets)PATH="$HOME/.cargo/bin:$PATH" cargo test -p eguiPATH="$HOME/.cargo/bin:$PATH" cargo clippy -p egui -- -D warningsPATH="$HOME/.cargo/bin:$PATH" cargo clippy -p egui -p egui_kittest --test regression_tests -- -D warnings(fails on existingclippy::unnecessary_wrapsincrates/egui_kittest/src/app_kind.rs:26)git diff --checkI opened this as draft because I did not run
./scripts/check.sh.Note: I used Codex while preparing this change, reviewed the final diff, and ran the listed checks locally.