emilk / emilk/egui

Suggestion: Draw Frames' strokes entirely within their bounding rectangle

Open
#3,041 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
30.6k
Forks
2.1k
Avg merge
1d 9h
Merged PRs (30d)
72

Description

Frames' strokes are currently centered on the edge of the Frame; half of the stroke is drawn inside the Frame, and half outside it. This makes it difficult to achieve pixel-perfect layouts:
- Narrow strokes (e.g. one display pixel thick) are unnecessarily blurred across multiple rows or columns.
- By default, enabling or disabling a widget's stroke (for example, when it's hovered) will change its apparent size by 0.5 points on each side. This makes it difficult to consistently line widgets up with one another, even when `WidgetVisuals::expansion` is set to zero.
- When a window's inner margins are set to zero, widgets will half-overlap with the window's stroke:

![image](https://github.com/emilk/egui/assets/65809749/4af7e0d7-c7aa-4f99-9d99-c5228fd67d1a)

Moving strokes entirely outside their Frame's bounding rectangle would ensure that the strokes never overlap with any child widgets, but it would make it more difficult to line up stroked widgets with unstroked ones. Instead, I'd recommend drawing Frames' strokes entirely within their bounding rectangle.

Contributor guide

Open the contributing guide

Research direction

No file or test is named. Locate the Frame stroke-rendering entry point, then inspect how its bounding rectangle and WidgetVisuals::expansion affect child overlap and apparent size. Done means strokes are drawn entirely within the Frame bounds without disrupting pixel alignment or zero-margin layouts, with regression coverage for these cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
frontend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.