Skip to content

Commit

Permalink
Remove StrokeKind::default (#5658)
Browse files Browse the repository at this point in the history
Since there is no natural default for `RectShape`.
  • Loading branch information
emilk authored Jan 30, 2025
1 parent 04fca9c commit 4b9da5f
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions crates/epaint/src/stroke.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,23 +69,24 @@ 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,
pub color: ColorMode,
pub kind: StrokeKind,
}

impl Default for PathStroke {
#[inline]
fn default() -> Self {
Self::NONE
}
}

impl PathStroke {
/// Same as [`PathStroke::default`].
pub const NONE: Self = Self {
Expand All @@ -99,7 +100,7 @@ impl PathStroke {
Self {
width: width.into(),
color: ColorMode::Solid(color.into()),
kind: StrokeKind::default(),
kind: StrokeKind::Middle,
}
}

Expand All @@ -114,7 +115,7 @@ impl PathStroke {
Self {
width: width.into(),
color: ColorMode::UV(Arc::new(callback)),
kind: StrokeKind::default(),
kind: StrokeKind::Middle,
}
}

Expand Down Expand Up @@ -168,7 +169,7 @@ impl From<Stroke> for PathStroke {
Self {
width: value.width,
color: ColorMode::Solid(value.color),
kind: StrokeKind::default(),
kind: StrokeKind::Middle,
}
}
}
Expand Down

0 comments on commit 4b9da5f

Please sign in to comment.