Skip to content

Commit d721bca

Browse files
indierustyKeavon
authored andcommitted
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.
1 parent 006209c commit d721bca

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

node-graph/gcore/src/vector/vector_data/modification.rs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -583,6 +583,15 @@ impl<'a> AppendBezpath<'a> {
583583
self.last_point_index = Some(next_point_index);
584584
}
585585

586+
fn reset(&mut self) {
587+
self.first_point = None;
588+
self.last_point = None;
589+
self.first_point_index = None;
590+
self.last_point_index = None;
591+
self.first_segment_id = None;
592+
self.last_segment_id = None;
593+
}
594+
586595
pub fn append_bezpath(vector_data: &'a mut VectorData, bezpath: BezPath) {
587596
let mut this = Self::new(vector_data);
588597
let mut elements = bezpath.elements().iter().peekable();
@@ -621,8 +630,8 @@ impl<'a> AppendBezpath<'a> {
621630
}
622631
}
623632
PathEl::ClosePath => {
624-
// Already handled using `append_segment_and_close_path()`;
625-
break;
633+
// Already handled using `append_segment_and_close_path()` hence we reset state and continue.
634+
this.reset();
626635
}
627636
}
628637
}

0 commit comments

Comments
 (0)