1
0
mirror of https://github.com/emilk/egui.git synced 2026-06-28 07:23:13 -04:00

Remove StrokeKind::default (#5658)

Since there is no natural default for `RectShape`.
This commit is contained in:
Emil Ernerfeldt
2025-01-30 21:02:50 +01:00
committed by GitHub
parent 04fca9c324
commit 4b9da5f650

View File

@@ -69,16 +69,10 @@ pub enum StrokeKind {
Outside,
}
impl Default for StrokeKind {
fn default() -> Self {
Self::Middle
}
}
/// Describes the width and color of paths. The color can either be solid or provided by a callback. For more information, see [`ColorMode`]
///
/// The default stroke is the same as [`Stroke::NONE`].
#[derive(Clone, Debug, Default, PartialEq)]
#[derive(Clone, Debug, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
pub struct PathStroke {
pub width: f32,
@@ -86,6 +80,13 @@ pub struct PathStroke {
pub kind: StrokeKind,
}
impl Default for PathStroke {
#[inline]
fn default() -> Self {
Self::NONE
}
}
impl PathStroke {
/// Same as [`PathStroke::default`].
pub const NONE: Self = Self {
@@ -99,7 +100,7 @@ impl PathStroke {
Self {
width: width.into(),
color: ColorMode::Solid(color.into()),
kind: StrokeKind::default(),
kind: StrokeKind::Middle,
}
}
@@ -114,7 +115,7 @@ impl PathStroke {
Self {
width: width.into(),
color: ColorMode::UV(Arc::new(callback)),
kind: StrokeKind::default(),
kind: StrokeKind::Middle,
}
}
@@ -168,7 +169,7 @@ impl From<Stroke> for PathStroke {
Self {
width: value.width,
color: ColorMode::Solid(value.color),
kind: StrokeKind::default(),
kind: StrokeKind::Middle,
}
}
}