diff --git a/editor/src/messages/portfolio/document/node_graph/node_graph_message_handler.rs b/editor/src/messages/portfolio/document/node_graph/node_graph_message_handler.rs index 8263edbace..f28d9d4e11 100644 --- a/editor/src/messages/portfolio/document/node_graph/node_graph_message_handler.rs +++ b/editor/src/messages/portfolio/document/node_graph/node_graph_message_handler.rs @@ -2265,6 +2265,12 @@ impl NodeGraphMessageHandler { } } + // The same layer/node may appear several times. Sort and dedup them for a stable ordering. + layers.sort(); + layers.dedup(); + nodes.sort(); + nodes.dedup(); + // Next, we decide what to display based on the number of layers and nodes selected match *layers.as_slice() { // If no layers are selected, show properties for all selected nodes diff --git a/editor/src/messages/portfolio/document/utility_types/nodes.rs b/editor/src/messages/portfolio/document/utility_types/nodes.rs index 66369026b3..c120938a80 100644 --- a/editor/src/messages/portfolio/document/utility_types/nodes.rs +++ b/editor/src/messages/portfolio/document/utility_types/nodes.rs @@ -61,6 +61,7 @@ pub struct LayerPanelEntry { pub clippable: bool, } +/// IMPORTANT: the same node may appear multiple times. #[derive(Debug, Clone, Default, serde::Serialize, serde::Deserialize, PartialEq, Eq, specta::Type)] pub struct SelectedNodes(pub Vec); @@ -129,6 +130,7 @@ impl SelectedNodes { self.selected_layers(metadata).any(|selected| selected == layer) } + /// IMPORTANT: the same node may appear multiple times. pub fn selected_nodes(&self) -> impl Iterator + '_ { self.0.iter() }