mirror of
https://github.com/emilk/egui.git
synced 2026-06-26 22:53:14 -04:00
Fix zero-width strokes still affecting the feathering color of boxes (#5485)
This commit is contained in:
@@ -161,10 +161,15 @@ where
|
||||
|
||||
impl From<Stroke> for PathStroke {
|
||||
fn from(value: Stroke) -> Self {
|
||||
Self {
|
||||
width: value.width,
|
||||
color: ColorMode::Solid(value.color),
|
||||
kind: StrokeKind::default(),
|
||||
if value.is_empty() {
|
||||
// Important, since we use the stroke color when doing feathering of the fill!
|
||||
Self::NONE
|
||||
} else {
|
||||
Self {
|
||||
width: value.width,
|
||||
color: ColorMode::Solid(value.color),
|
||||
kind: StrokeKind::default(),
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -502,6 +502,8 @@ impl Path {
|
||||
/// Calling this may reverse the vertices in the path if they are wrong winding order.
|
||||
///
|
||||
/// The preferred winding order is clockwise.
|
||||
///
|
||||
/// The stroke colors is used for color-correct feathering.
|
||||
pub fn fill(&mut self, feathering: f32, color: Color32, stroke: &PathStroke, out: &mut Mesh) {
|
||||
fill_closed_path(feathering, &mut self.0, color, stroke, out);
|
||||
}
|
||||
@@ -918,7 +920,7 @@ fn stroke_path(
|
||||
) {
|
||||
let n = path.len() as u32;
|
||||
|
||||
if stroke.width <= 0.0 || stroke.color == ColorMode::TRANSPARENT || n < 2 {
|
||||
if stroke.is_empty() || n < 2 {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user