Skip to content

Commit 7cd5abc

Browse files
mTvare6Keavon
authored andcommitted
tmp, skip ones being added to ab
1 parent b178ed4 commit 7cd5abc

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

editor/src/messages/portfolio/portfolio_message_handler.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -926,6 +926,7 @@ impl MessageHandler<PortfolioMessage, PortfolioMessageData<'_>> for PortfolioMes
926926
let viewport_center_in_doc_space = transform.inverse().transform_point2(viewport_center);
927927

928928
let mut positions = Vec::new();
929+
let mut artboards = Vec::new(); // Track artboards separately
929930

930931
for &layer in &layers {
931932
if document.network_interface.is_artboard(&layer.to_node(), &[]) {
@@ -938,8 +939,20 @@ impl MessageHandler<PortfolioMessage, PortfolioMessageData<'_>> for PortfolioMes
938939
}
939940

940941
positions.push((layer, bounds[0], true));
942+
artboards.push(layer); // Add to artboards list
941943
}
942944
} else {
945+
// Skip layers that are children of artboards we're already moving
946+
let is_child_of_moving_artboard = artboards.iter().any(|&artboard| {
947+
layer.ancestors(document.metadata())
948+
.skip(1) // Skip self
949+
.any(|ancestor| ancestor == artboard)
950+
});
951+
952+
if is_child_of_moving_artboard {
953+
continue; // Skip this layer as its parent artboard will be moved
954+
}
955+
943956
if let Some(mut modify_inputs) = ModifyInputsContext::new_with_layer(layer, &mut document.network_interface, responses) {
944957
if let Some(transform_node_id) = modify_inputs.existing_node_id("Transform", true) {
945958
if let Some(network) = modify_inputs.network_interface.network(&[]) {
@@ -994,7 +1007,6 @@ impl MessageHandler<PortfolioMessage, PortfolioMessageData<'_>> for PortfolioMes
9941007
}
9951008
}
9961009
}
997-
9981010
PortfolioMessage::PasteImage {
9991011
name,
10001012
image,

0 commit comments

Comments
 (0)