Fix 'Solidify Stroke' node not appending elements in the BezPath after the first ClosePath element (#2732)

Issue:
Previously the `AppendBezpath::append_bezpath()` method didn't append the elements after the first `ClosePath` element in the given BezPath, but the Bezpath can contain more than one path. The 'Solidify Stroke' node creates at least two paths, but the `append_bezpath` method only appends the first path, and hence 'Solidify Stroke' didn't work correctly.

Fix:
Now `AppendBezpath::append_bezpath()` appends all the paths in the given BezPath, which also fixes the 'Solidify Stroke' node.
This commit is contained in:
Priyanshu 2025-06-18 15:40:40 +05:30 committed by Keavon Chambers
parent 006209c5d0
commit d721bca85f

View file

@ -583,6 +583,15 @@ impl<'a> AppendBezpath<'a> {
self.last_point_index = Some(next_point_index);
}
fn reset(&mut self) {
self.first_point = None;
self.last_point = None;
self.first_point_index = None;
self.last_point_index = None;
self.first_segment_id = None;
self.last_segment_id = None;
}
pub fn append_bezpath(vector_data: &'a mut VectorData, bezpath: BezPath) {
let mut this = Self::new(vector_data);
let mut elements = bezpath.elements().iter().peekable();
@ -621,8 +630,8 @@ impl<'a> AppendBezpath<'a> {
}
}
PathEl::ClosePath => {
// Already handled using `append_segment_and_close_path()`;
break;
// Already handled using `append_segment_and_close_path()` hence we reset state and continue.
this.reset();
}
}
}