From 3490111b9691b32f88a60ca72050eef65545ce82 Mon Sep 17 00:00:00 2001 From: James Lindsay <78500760+0HyperCube@users.noreply.github.com> Date: Sat, 8 Nov 2025 08:29:08 +0000 Subject: [PATCH] Pen tool: do not merge with ancestor layer as it breaks the graph (#3347) --- .../tool/common_functionality/graph_modification_utils.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/editor/src/messages/tool/common_functionality/graph_modification_utils.rs b/editor/src/messages/tool/common_functionality/graph_modification_utils.rs index 4941701e..0c2d87a1 100644 --- a/editor/src/messages/tool/common_functionality/graph_modification_utils.rs +++ b/editor/src/messages/tool/common_functionality/graph_modification_utils.rs @@ -32,7 +32,8 @@ pub fn find_spline(document: &DocumentMessageHandler, layer: LayerNodeIdentifier /// Merge `second_layer` to the `first_layer`. pub fn merge_layers(document: &DocumentMessageHandler, first_layer: LayerNodeIdentifier, second_layer: LayerNodeIdentifier, responses: &mut VecDeque) { - if first_layer == second_layer { + // Skip layers that are children of each other (or the same) + if first_layer.ancestors(document.metadata()).any(|l| l == second_layer) || second_layer.ancestors(document.metadata()).any(|l| l == first_layer) { return; } // Calculate the downstream transforms in order to bring the other vector geometry into the same layer space