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 <keavon@keavon.com>
This commit is contained in:
James Lindsay 2025-07-26 06:28:02 +01:00 committed by GitHub
parent 85021fd9e0
commit a1796dbc08
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 0 deletions

View File

@ -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

View File

@ -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<NodeId>);
@ -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<Item = &NodeId> + '_ {
self.0.iter()
}