1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-31 13:50:04 -04:00
Files
egui/crates
Lucas Meurer 64470b2d40 Add Frame::expand_in_place, Frame::invisible and TextVisuals constructors
The expansion/stroke correction on a widget's margins was written out by
hand. Move it into `Frame::expand_in_place`, which knows the frame's own
stroke width, so a caller states the intent instead of the arithmetic.
`Frame::invisible` goes with it: a frame that keeps its layout but drops
its paint.

Two fixes fall out of it in the button style:

* A small button zeroed its vertical padding after the correction, which
  left the frame a `stroke.width - expansion` tall. Zeroing before the
  correction makes it exactly zero in every state, which is what "must
  not add any height" means.
* The invisible frame of a button that hides its frame when inactive
  dropped the outer margin and the stroke width, so it was not, in fact,
  as big as the painted one. It now keeps the whole frame and only drops
  the paint.

Also give `TextVisuals` a `new` and a `from_widget_visuals`, replacing the
local `text_visuals` helper, and add `HasClasses::add_classes` and
`HasClasses::with_classes`.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-31 13:56:49 +02:00
..
2026-08-26 06:09:32 +00:00