mirror of
https://github.com/penpot/penpot.git
synced 2025-07-14 17:57:17 +02:00
🐛 Fix caps for rounded paths
This commit is contained in:
parent
8db910baee
commit
78d6166bac
2 changed files with 8 additions and 6 deletions
|
@ -443,7 +443,7 @@ impl RenderState {
|
||||||
s.canvas().concat(&matrix);
|
s.canvas().concat(&matrix);
|
||||||
});
|
});
|
||||||
|
|
||||||
if shape.fills.is_empty() && matches!(shape.shape_type, Type::Group(_)) {
|
if shape.fills.is_empty() && !matches!(shape.shape_type, Type::Group(_)) {
|
||||||
if let Some(fills_to_render) = self.nested_fills.last() {
|
if let Some(fills_to_render) = self.nested_fills.last() {
|
||||||
let fills_to_render = fills_to_render.clone();
|
let fills_to_render = fills_to_render.clone();
|
||||||
for fill in fills_to_render.iter() {
|
for fill in fills_to_render.iter() {
|
||||||
|
@ -664,7 +664,7 @@ impl RenderState {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if let Type::Group(group) = element.shape_type {
|
if let Type::Group(_) = element.shape_type {
|
||||||
self.nested_fills.pop();
|
self.nested_fills.pop();
|
||||||
}
|
}
|
||||||
self.surfaces.canvas(SurfaceId::Current).restore();
|
self.surfaces.canvas(SurfaceId::Current).restore();
|
||||||
|
|
|
@ -187,9 +187,11 @@ fn handle_stroke_caps(
|
||||||
scale: f32,
|
scale: f32,
|
||||||
antialias: bool,
|
antialias: bool,
|
||||||
) {
|
) {
|
||||||
let points_count = path.count_points();
|
let mut points = vec![Point::default(); path.count_points()];
|
||||||
let mut points = vec![Point::default(); points_count];
|
path.get_points(&mut points);
|
||||||
let c_points = path.get_points(&mut points);
|
// Curves can have duplicated points, so let's remove consecutive duplicated points
|
||||||
|
points.dedup();
|
||||||
|
let c_points = points.len();
|
||||||
|
|
||||||
// Closed shapes don't have caps
|
// Closed shapes don't have caps
|
||||||
if c_points >= 2 && is_open {
|
if c_points >= 2 && is_open {
|
||||||
|
@ -213,7 +215,7 @@ fn handle_stroke_caps(
|
||||||
stroke.width,
|
stroke.width,
|
||||||
&mut paint_stroke,
|
&mut paint_stroke,
|
||||||
last_point,
|
last_point,
|
||||||
&points[points_count - 2],
|
&points[c_points - 2],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue