From bf3eeaccc00f1d8c9dec45d67f5c03d05607ace5 Mon Sep 17 00:00:00 2001 From: ViktorBystrov72 <18964918+ViktorBystrov72@users.noreply.github.com> Date: Mon, 23 Nov 2026 16:53:09 +0500 Subject: [PATCH 1/2] Render: cover the effects on rotated radial repeat copies --- crates/render/src/fx/bounds.rs | 25 ++++++++++++++++--------- crates/render/src/tests/changed.rs | 28 ++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 9 deletions(-) diff --git a/crates/render/src/fx/bounds.rs b/crates/render/src/fx/bounds.rs index 2a554a3d92..0883efb68f 100644 --- a/crates/render/src/fx/bounds.rs +++ b/crates/render/src/fx/bounds.rs @@ -730,7 +730,13 @@ fn cull_bounds_in(symbols: &SymbolBoxes, n: &Node, after_reshape: bool, brush: b NodeKind::Blend { .. } => { let b = n.reach_bounds_with(symbols)?; let a = live_content_reach(symbols, n); - vectorcraft_geom::union_opt(Some(b.inflate(a, a)), placed_blend_effect_bounds(symbols, n)) + vectorcraft_geom::union_opt(Some(b.inflate(a, a)), placed_live_effect_bounds(symbols, n)) + } + // A radial repeat rotates each copy before applying the source's geometry effects. + NodeKind::Repeat(_) => { + let b = n.visual_bounds_with(symbols)?; + let a = live_content_reach(symbols, n); + vectorcraft_geom::union_opt(Some(b.inflate(a, a)), placed_live_effect_bounds(symbols, n)) } _ => { let b = n.visual_bounds_with(symbols)?; @@ -815,7 +821,7 @@ pub(crate) fn with_own_raster_reach(symbols: &SymbolBoxes, n: &Node, b: Rect) -> /// (Revolve builds no art from type). fn own_box(symbols: &SymbolBoxes, n: &Node) -> Option { let b = match &n.kind { - NodeKind::Blend { .. } => vectorcraft_geom::union_opt(n.reach_bounds_with(symbols), placed_blend_effect_bounds(symbols, n)), + NodeKind::Blend { .. } => vectorcraft_geom::union_opt(n.reach_bounds_with(symbols), placed_live_effect_bounds(symbols, n)), _ => n.visual_bounds_with(symbols), }?; Some(match &n.kind { @@ -824,13 +830,14 @@ fn own_box(symbols: &SymbolBoxes, n: &Node) -> Option { }) } -/// A rotated blend's effect-bearing content, measured after spine placement. Geometry effects -/// run on the placed shapes, so their reach on the original keys need not cover what they paint. -/// Effect-free blends keep the quick rail envelope without evaluating their steps. -fn placed_blend_effect_bounds(symbols: &SymbolBoxes, n: &Node) -> Option { - let NodeKind::Blend { spec, .. } = &n.kind else { return None }; - if spec.orientation != vectorcraft_doc::BlendOrientation::AlignToPath { - return None; +/// A radial repeat's copies or a spine-aligned blend's steps, measured after rotation. Geometry +/// effects run on the placed shapes, so their reach on the source need not cover what they paint. +/// Without effects, the renderer keeps the quick bounds without evaluating the copies or steps. +fn placed_live_effect_bounds(symbols: &SymbolBoxes, n: &Node) -> Option { + match &n.kind { + NodeKind::Blend { spec, .. } if spec.orientation == vectorcraft_doc::BlendOrientation::AlignToPath => {} + NodeKind::Repeat(r) if matches!(r.kind, vectorcraft_doc::RepeatKind::Radial { .. }) => {} + _ => return None, } let mut has_effects = false; n.walk(&mut |c| { diff --git a/crates/render/src/tests/changed.rs b/crates/render/src/tests/changed.rs index 07251df938..756dd18e5c 100644 --- a/crates/render/src/tests/changed.rs +++ b/crates/render/src/tests/changed.rs @@ -135,6 +135,34 @@ fn moving_a_shadowed_object_changes_where_its_shadow_falls() { assert!(a.x1 > 86.0 && a.y1 > 70.0, "the shadow, before and after: {a:?}"); } +#[test] +fn moving_a_radial_repeat_redraws_the_effects_on_its_rotated_copies() { + for effected in [false, true] { + let mut old = Document::new(110.0, 80.0); + let source_id = old.alloc_id(); + let mut source = Node::path( + source_id, + shapes::rectangle(Rect::new(47.0, 25.0, 49.0, 45.0)), + Appearance::basic(Paint::solid(Color::BLACK), Paint::None, 0.0), + ); + if effected { + source.appearance.effects.push(vectorcraft_doc::Effect { + id: "distort.transform".into(), + params: serde_json::json!({"scaleH": 400, "scaleV": 100, "reference": 4}), + visible: true, + }); + } + let repeat = vectorcraft_doc::RepeatSpec::radial(vec![Arc::new(source)], 4, Some(12.0)); + let id = old.alloc_id(); + old.insert(Some(old.layers[0].id), 0, Node::new(id, vectorcraft_doc::NodeKind::Repeat(repeat))).unwrap(); + let mut moved = old.clone(); + moved.node_mut(id).unwrap().transform(Affine::translate((3.0, 4.0)), false); + // A partial redraw must reproduce the whole frame, both on the move and on Undo. + area(redraw(&old, &moved)); + area(redraw(&moved, &old)); + } +} + #[test] fn adding_removing_and_restacking_change_those_objects() { let (old, [loose, _, _, _, other]) = document(); From fdffa121a9a7613ee78f8a7ec4d649795a3fb02a Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sat, 28 Nov 2026 08:05:59 -0800 Subject: [PATCH 2/2] Render: cover the effects on reflected mirror repeat copies A Mirror Repeat on a slanted axis reflects its copy before the source's geometry effects run, so a Transform effect on the copy painted outside the move and Undo damage region, the same fault #9169 fixes for Radial Repeat. Mirror repeats now take the same measured bounds, with a test that fails without the change. --- crates/render/src/fx/bounds.rs | 10 ++++++---- crates/render/src/tests/changed.rs | 28 ++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 4 deletions(-) diff --git a/crates/render/src/fx/bounds.rs b/crates/render/src/fx/bounds.rs index eefe3de3e7..2e05fca92b 100644 --- a/crates/render/src/fx/bounds.rs +++ b/crates/render/src/fx/bounds.rs @@ -758,7 +758,8 @@ fn cull_bounds_in(symbols: &SymbolBoxes, n: &Node, after_reshape: bool, brush: b let a = live_content_reach(symbols, n); vectorcraft_geom::union_opt(Some(b.inflate(a, a)), placed_live_effect_bounds(symbols, n)) } - // A radial repeat rotates each copy before applying the source's geometry effects. + // A radial or mirror repeat rotates or reflects each copy before applying the source's + // geometry effects. NodeKind::Repeat(_) => { let b = n.visual_bounds_with(symbols)?; let a = live_content_reach(symbols, n); @@ -856,13 +857,14 @@ fn own_box(symbols: &SymbolBoxes, n: &Node) -> Option { }) } -/// A radial repeat's copies or a spine-aligned blend's steps, measured after rotation. Geometry -/// effects run on the placed shapes, so their reach on the source need not cover what they paint. +/// A radial or mirror repeat's copies or a spine-aligned blend's steps, measured after they are +/// rotated or reflected. Geometry effects run on the placed shapes, so their reach on the source +/// need not cover what they paint. /// Without effects, the renderer keeps the quick bounds without evaluating the copies or steps. fn placed_live_effect_bounds(symbols: &SymbolBoxes, n: &Node) -> Option { match &n.kind { NodeKind::Blend { spec, .. } if spec.orientation == vectorcraft_doc::BlendOrientation::AlignToPath => {} - NodeKind::Repeat(r) if matches!(r.kind, vectorcraft_doc::RepeatKind::Radial { .. }) => {} + NodeKind::Repeat(r) if matches!(r.kind, vectorcraft_doc::RepeatKind::Radial { .. } | vectorcraft_doc::RepeatKind::Mirror { .. }) => {} _ => return None, } let mut has_effects = false; diff --git a/crates/render/src/tests/changed.rs b/crates/render/src/tests/changed.rs index 7ccb472fda..4440c06baf 100644 --- a/crates/render/src/tests/changed.rs +++ b/crates/render/src/tests/changed.rs @@ -199,6 +199,34 @@ fn moving_a_radial_repeat_redraws_the_effects_on_its_rotated_copies() { } } +#[test] +fn moving_a_slanted_mirror_repeat_redraws_the_effects_on_its_reflected_copy() { + for effected in [false, true] { + let mut old = Document::new(110.0, 80.0); + let source_id = old.alloc_id(); + let mut source = Node::path( + source_id, + shapes::rectangle(Rect::new(47.0, 25.0, 49.0, 45.0)), + Appearance::basic(Paint::solid(Color::BLACK), Paint::None, 0.0), + ); + if effected { + source.appearance.effects.push(vectorcraft_doc::Effect { + id: "distort.transform".into(), + params: serde_json::json!({"scaleH": 400, "scaleV": 100, "reference": 4}), + visible: true, + }); + } + let repeat = vectorcraft_doc::RepeatSpec::mirror(vec![Arc::new(source)], 45.0, 6.0); + let id = old.alloc_id(); + old.insert(Some(old.layers[0].id), 0, Node::new(id, vectorcraft_doc::NodeKind::Repeat(repeat))).unwrap(); + let mut moved = old.clone(); + moved.node_mut(id).unwrap().transform(Affine::translate((3.0, 4.0)), false); + // A partial redraw must reproduce the whole frame, both on the move and on Undo. + area(redraw(&old, &moved)); + area(redraw(&moved, &old)); + } +} + #[test] fn adding_removing_and_restacking_change_those_objects() { let (old, [loose, _, _, _, other]) = document();