Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Selection history navigation with Alt+[ and Alt+] keys should filter out empty selections #2136

Closed
Original file line number Diff line number Diff line change
Expand Up @@ -1209,13 +1209,15 @@ impl<'a> MessageHandler<NodeGraphMessage, NodeGraphHandlerData<'a>> for NodeGrap
responses.add(BroadcastEvent::SelectionChanged);
}
NodeGraphMessage::SelectedNodesSet { nodes } => {
let Some(selected_nodes) = network_interface.selected_nodes_mut(selection_network_path) else {
log::error!("Could not get selected nodes in NodeGraphMessage::SelectedNodesSet");
return;
};
selected_nodes.set_selected_nodes(nodes);
responses.add(BroadcastEvent::SelectionChanged);
responses.add(PropertiesPanelMessage::Refresh);
if !nodes.is_empty() {
let Some(selected_nodes) = network_interface.selected_nodes_mut(selection_network_path) else {
log::error!("Could not get selected nodes in NodeGraphMessage::SelectedNodesSet");
return;
};
selected_nodes.set_selected_nodes(nodes);
responses.add(BroadcastEvent::SelectionChanged);
responses.add(PropertiesPanelMessage::Refresh);
}
}
NodeGraphMessage::SendClickTargets => responses.add(FrontendMessage::UpdateClickTargets {
click_targets: Some(network_interface.collect_frontend_click_targets(breadcrumb_network_path)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1585,6 +1585,7 @@ impl NodeNetworkInterface {
/// Mutably get the selected nodes for the network at the network_path. Every time they are mutated, the transient metadata for the top of the stack gets unloaded.
pub fn selected_nodes_mut(&mut self, network_path: &[NodeId]) -> Option<&mut SelectedNodes> {
self.unload_stack_dependents(network_path);

let Some(network_metadata) = self.network_metadata_mut(network_path) else {
log::error!("Could not get nested network_metadata in selected_nodes");
return None;
Expand Down
1 change: 1 addition & 0 deletions editor/src/messages/tool/tool_messages/select_tool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1010,6 +1010,7 @@ impl Fsm for SelectToolFsmState {
let quad = tool_data.selection_quad();
let new_selected: HashSet<_> = document.intersect_quad_no_artboards(quad, input).collect();
let current_selected: HashSet<_> = document.network_interface.selected_nodes(&[]).unwrap().selected_layers(document.metadata()).collect();

if new_selected != current_selected {
tool_data.layers_dragging = new_selected.into_iter().collect();
responses.add(NodeGraphMessage::SelectedNodesSet {
Expand Down
Loading