🐛 Fix inner strokes clipped on boards created from rect

This commit is contained in:
Elena Torro 2026-05-19 10:45:46 +02:00 committed by Alonso Torres
parent 27df2aebfc
commit fb6c522cc0

View File

@ -2508,12 +2508,26 @@ impl RenderState {
_ => {} _ => {}
} }
//In clipped content strokes are drawn over the contained elements // Strokes are drawn over children for clipped frames (all strokes), and for non-clipped
if element.clip() { // frames with inner strokes (inner strokes only — non-inner were rendered before children).
let needs_exit_strokes = element.clip()
|| (matches!(element.shape_type, Type::Frame(_)) && element.has_inner_stroke());
if needs_exit_strokes {
let mut element_strokes: Cow<Shape> = Cow::Borrowed(element); let mut element_strokes: Cow<Shape> = Cow::Borrowed(element);
element_strokes.to_mut().clear_fills(); element_strokes.to_mut().clear_fills();
element_strokes.to_mut().clear_shadows(); element_strokes.to_mut().clear_shadows();
element_strokes.to_mut().clip_content = false; element_strokes.to_mut().clip_content = false;
// For non-clipped frames, non-inner strokes were already rendered inline.
if !element.clip() {
let is_open = element.is_open();
element_strokes
.to_mut()
.strokes
.retain(|s| s.render_kind(is_open) == StrokeKind::Inner);
}
// Frame blur is applied at the save_layer level - avoid double blur on the stroke paint // Frame blur is applied at the save_layer level - avoid double blur on the stroke paint
if Self::frame_clip_layer_blur(element).is_some() { if Self::frame_clip_layer_blur(element).is_some() {
element_strokes.to_mut().set_blur(None); element_strokes.to_mut().set_blur(None);
@ -3273,8 +3287,24 @@ impl RenderState {
.draw_into(SurfaceId::DropShadows, target_surface, None); .draw_into(SurfaceId::DropShadows, target_surface, None);
} }
// For frames without clip_content, inner strokes must render after children in
// render_shape_exit so children don't paint over them. Strip them here.
let element_for_inline: Cow<Shape> = if matches!(element.shape_type, Type::Frame(_))
&& !element.clip_content
&& element.has_inner_stroke()
{
let is_open = element.is_open();
let mut modified = element.clone();
modified
.strokes
.retain(|s| s.render_kind(is_open) != StrokeKind::Inner);
Cow::Owned(modified)
} else {
Cow::Borrowed(element)
};
self.render_shape( self.render_shape(
element, &element_for_inline,
clip_bounds.clone(), clip_bounds.clone(),
SurfaceId::Fills, SurfaceId::Fills,
SurfaceId::Strokes, SurfaceId::Strokes,