1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-31 05:40:03 -04:00

RectShape: add control over where the stoke goes (#5647)

Adds `RectShape::stroke_kind` so you can select if the stroke goes
inside, outside, or is centered on the rectangle.

Also adds `RectShape::round_to_pixels` so you can override
`TessellationOptions::round_rects_to_pixels`.
This commit is contained in:
Emil Ernerfeldt
2025-01-29 12:46:12 +01:00
committed by GitHub
parent 83649f2e29
commit 6be17136f2
5 changed files with 76 additions and 21 deletions

View File

@@ -56,17 +56,17 @@ impl std::hash::Hash for Stroke {
}
/// Describes how the stroke of a shape should be painted.
#[derive(Clone, Debug, PartialEq, Eq)]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
pub enum StrokeKind {
/// The stroke should be painted entirely outside of the shape
Outside,
/// The stroke should be painted entirely inside of the shape
Inside,
/// The stroke should be painted right on the edge of the shape, half inside and half outside.
Middle,
/// The stroke should be painted entirely outside of the shape
Outside,
}
impl Default for StrokeKind {