Add path closing and segment extension to the Pen tool (#753)

* Close paths with pen tool

* Issue Z command always at end of path

* Small code review style changes

* Extending paths

* Fix mirror on extend path

* Code review tweaks

Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
0HyperCube
2022-08-21 00:36:17 +01:00
committed by Keavon Chambers
co-authored by Keavon Chambers
parent 09dace0147
commit 1bcf55939d
5 changed files with 327 additions and 108 deletions
+8 -5
View File
@@ -384,18 +384,21 @@ impl Subpath {
} else if last_out_handle.is_some() || first_in_handle.is_some() {
result.push('Q');
write_positions(&mut result, [last_out_handle, first_in_handle, first_in_anchor]);
} else {
result.push('Z');
}
} else if command == 'M' {
// Update the last moveto position
result.push('Z');
}
// Update the last moveto position
else if command == 'M' {
(first_in_handle, first_in_anchor) = (in_handle, anchor);
result.push(command);
write_positions(&mut result, [None, None, anchor]);
} else {
}
// Write other path commands (line to/quadratic to/cubic to)
else {
result.push(command);
write_positions(&mut result, [last_out_handle, in_handle, anchor]);
}
start_new_contour = command == 'Z';
last_out_handle = out_handle;
}