mirror of
https://github.com/penpot/penpot.git
synced 2026-05-30 04:08:08 +00:00
🐛 Fix stroke rendering on drag (#9871)
This commit is contained in:
parent
34f30e38aa
commit
75c61f9211
@ -1445,6 +1445,7 @@ impl Shape {
|
||||
path_transform.as_ref(),
|
||||
&self.selrect,
|
||||
self.svg_attrs.as_ref(),
|
||||
true,
|
||||
) else {
|
||||
continue;
|
||||
};
|
||||
|
||||
@ -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<Path> {
|
||||
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);
|
||||
|
||||
@ -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()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user