core: Fix incorrect closing of paths in drawing API (fix #5598)

The path starting position was not being set correctly after a
moveTo command, which could cause stray strokes to appear in the
drawing.

Fixes #5598, #5768, #5957.
This commit is contained in:
Mike Welsh 2022-01-01 18:21:24 -08:00
parent 655adedc1c
commit 34ed9cbbaa
1 changed files with 2 additions and 2 deletions

View File

@ -142,10 +142,10 @@ impl Drawing {
}
pub fn draw_command(&mut self, command: DrawCommand) {
let add_to_bounds = if let DrawCommand::MoveTo { .. } = command {
let add_to_bounds = if let DrawCommand::MoveTo { x, y } = command {
// Close any pending fills before moving.
self.close_path();
self.fill_start = self.cursor;
self.fill_start = (x, y);
false
} else {
true