Fix zero-width strokes still affecting the feathering color of boxes (#5485)
This commit is contained in:
parent
e8029178b6
commit
045ed41efc
|
|
@ -161,10 +161,15 @@ where
|
||||||
|
|
||||||
impl From<Stroke> for PathStroke {
|
impl From<Stroke> for PathStroke {
|
||||||
fn from(value: Stroke) -> Self {
|
fn from(value: Stroke) -> Self {
|
||||||
Self {
|
if value.is_empty() {
|
||||||
width: value.width,
|
// Important, since we use the stroke color when doing feathering of the fill!
|
||||||
color: ColorMode::Solid(value.color),
|
Self::NONE
|
||||||
kind: StrokeKind::default(),
|
} 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.
|
/// Calling this may reverse the vertices in the path if they are wrong winding order.
|
||||||
///
|
///
|
||||||
/// The preferred winding order is clockwise.
|
/// 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) {
|
pub fn fill(&mut self, feathering: f32, color: Color32, stroke: &PathStroke, out: &mut Mesh) {
|
||||||
fill_closed_path(feathering, &mut self.0, color, stroke, out);
|
fill_closed_path(feathering, &mut self.0, color, stroke, out);
|
||||||
}
|
}
|
||||||
|
|
@ -918,7 +920,7 @@ fn stroke_path(
|
||||||
) {
|
) {
|
||||||
let n = path.len() as u32;
|
let n = path.len() as u32;
|
||||||
|
|
||||||
if stroke.width <= 0.0 || stroke.color == ColorMode::TRANSPARENT || n < 2 {
|
if stroke.is_empty() || n < 2 {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue