From bb071489f1252a416ccf731c2e90e5bf7c744ab0 Mon Sep 17 00:00:00 2001 From: Alejandro Alonso Date: Tue, 7 Jan 2025 12:56:54 +0100 Subject: [PATCH] :bug: Fix dotted path widh calculation --- render-wasm/src/shapes/strokes.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/render-wasm/src/shapes/strokes.rs b/render-wasm/src/shapes/strokes.rs index 95f99a9f0..cf56a02f9 100644 --- a/render-wasm/src/shapes/strokes.rs +++ b/render-wasm/src/shapes/strokes.rs @@ -32,7 +32,7 @@ pub enum StrokeCap { // Square, } -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, Copy, PartialEq)] pub enum StrokeKind { InnerStroke, OuterStroke, @@ -55,7 +55,7 @@ impl Stroke { if is_open { StrokeKind::CenterStroke } else { - self.kind.clone() + self.kind } } @@ -133,7 +133,12 @@ impl Stroke { let path_effect = match self.style { StrokeStyle::Dotted => { let mut circle_path = skia::Path::new(); - circle_path.add_circle((0.0, 0.0), self.width / 2.0, None); + let width = match self.kind { + StrokeKind::InnerStroke => self.width, + StrokeKind::CenterStroke => self.width / 2.0, + StrokeKind::OuterStroke => self.width, + }; + circle_path.add_circle((0.0, 0.0), width, None); let advance = self.width + 5.0; skia::PathEffect::path_1d( &circle_path,