From 75c61f921165932a9ba0d1a70f60612e886c5b75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elena=20Torr=C3=B3?= Date: Tue, 26 May 2026 13:14:38 +0200 Subject: [PATCH] :bug: Fix stroke rendering on drag (#9871) --- render-wasm/src/shapes.rs | 1 + render-wasm/src/shapes/stroke_paths.rs | 9 +++++++++ render-wasm/src/wasm/paths.rs | 1 + 3 files changed, 11 insertions(+) diff --git a/render-wasm/src/shapes.rs b/render-wasm/src/shapes.rs index 0b26cd632f..1eb22a3b93 100644 --- a/render-wasm/src/shapes.rs +++ b/render-wasm/src/shapes.rs @@ -1445,6 +1445,7 @@ impl Shape { path_transform.as_ref(), &self.selrect, self.svg_attrs.as_ref(), + true, ) else { continue; }; diff --git a/render-wasm/src/shapes/stroke_paths.rs b/render-wasm/src/shapes/stroke_paths.rs index f98c01ca0f..358be86141 100644 --- a/render-wasm/src/shapes/stroke_paths.rs +++ b/render-wasm/src/shapes/stroke_paths.rs @@ -10,12 +10,17 @@ use crate::math::Rect; /// Uses Skia's `fill_path_with_paint` to expand the stroke into a filled region, /// then clips it via boolean ops for inner/outer alignment. The optional /// `path_transform` maps from local shape coords to the drawing space (and back). +/// +/// When `solid_outline` is true, any dash/dot PathEffect is stripped so the result +/// is a continuous stroke region — useful for clipping (e.g. drag crop cache) where +/// dash gaps should not punch holes in the clip mask. pub fn stroke_to_path( stroke: &Stroke, shape_path: &Path, path_transform: Option<&skia::Matrix>, selrect: &Rect, svg_attrs: Option<&SvgAttrs>, + solid_outline: bool, ) -> Option { let skia_shape_path = shape_path.to_skia_path(svg_attrs); @@ -28,6 +33,10 @@ pub fn stroke_to_path( let is_open = shape_path.is_open(); let mut paint = stroke.to_paint(selrect, svg_attrs, true); + if solid_outline { + paint.set_path_effect(None); + } + let render_kind = stroke.render_kind(is_open); if render_kind != StrokeKind::Center { paint.set_stroke_width(stroke.width * 2.0); diff --git a/render-wasm/src/wasm/paths.rs b/render-wasm/src/wasm/paths.rs index 730bb6fe85..2350edb393 100644 --- a/render-wasm/src/wasm/paths.rs +++ b/render-wasm/src/wasm/paths.rs @@ -255,6 +255,7 @@ pub extern "C" fn convert_stroke_to_path(stroke_index: i32) -> *mut u8 { path_transform.as_ref(), &shape.selrect, shape.svg_attrs.as_ref(), + false, ) { result = path .segments()