From a1796dbc08c98c0cbebb654e9418cf3b2e857132 Mon Sep 17 00:00:00 2001 From: James Lindsay <78500760+0HyperCube@users.noreply.github.com> Date: Sat, 26 Jul 2025 06:28:02 +0100 Subject: [PATCH] Fix a single layer twice selected hiding the properties (#2911) * Fix a single layer twice selected hiding the properties * Comment that the same node appears several times --------- Co-authored-by: Keavon Chambers --- .../document/node_graph/node_graph_message_handler.rs | 6 ++++++ .../src/messages/portfolio/document/utility_types/nodes.rs | 2 ++ 2 files changed, 8 insertions(+) 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 8263edba..f28d9d4e 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 66369026..c120938a 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() }