Repository: GraphiteEditor/Graphite
File: editor/src/messages/tool/tool_messages/select_tool.rs (Rust)

Code before:
				let selection = tool_data.nested_selection_behavior;
				SelectToolFsmState::Ready { selection }
			}
			(
				SelectToolFsmState::DrawingBox { .. },
				SelectToolMessage::DragStop {
					remove_from_selection,
					negative_box_selection,
				},
			) => {
				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 {
					// Negative selection when both Shift and Ctrl are pressed
					if input.keyboard.key(remove_from_selection) && input.keyboard.key(negative_box_selection) {
						let updated_selection = current_selected
							.into_iter()
							.filter(|layer| !new_selected.iter().any(|selected| layer.starts_with(*selected, document.metadata())))
							.collect();
						tool_data.layers_dragging = updated_selection;
					} else {
						let parent_selected: HashSet<_> = new_selected
							.into_iter()
							.map(|layer| {
								// Find the  parent node
								layer.ancestors(document.metadata()).filter(not_artboard(document)).last().unwrap_or(layer)
							})
							.collect();
						tool_data.layers_dragging.extend(parent_selected.iter().copied());
					}
					responses.add(NodeGraphMessage::SelectedNodesSet {
						nodes: tool_data
							.layers_dragging
							.iter()
							.filter_map(|layer| {
								if *layer != LayerNodeIdentifier::ROOT_PARENT {
									Some(layer.to_node())
								} else {
									log::error!("ROOT_PARENT cannot be part of tool_data.layers_dragging");
									None
								}
							})
							.collect(),
					});
				}
				responses.add(OverlaysMessage::Draw);

				let selection = tool_data.nested_selection_behavior;
				SelectToolFsmState::Ready { selection }
			}

Review comment (suggestion):
```suggestion
								// Find the parent node
```

Code after:
				let selection = tool_data.nested_selection_behavior;
				SelectToolFsmState::Ready { selection }
			}
			(
				SelectToolFsmState::DrawingBox { .. },
				SelectToolMessage::DragStop {
					remove_from_selection,
					negative_box_selection,
				},
			) => {
				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 {
					// Negative selection when both Shift and Ctrl are pressed
					if input.keyboard.key(remove_from_selection) && input.keyboard.key(negative_box_selection) {
						let updated_selection = current_selected
							.into_iter()
							.filter(|layer| !new_selected.iter().any(|selected| layer.starts_with(*selected, document.metadata())))
							.collect();
						tool_data.layers_dragging = updated_selection;
					} else {
						let parent_selected: HashSet<_> = new_selected
							.into_iter()
							.map(|layer| {
								// Find the parent node
								layer.ancestors(document.metadata()).filter(not_artboard(document)).last().unwrap_or(layer)
							})
							.collect();
						tool_data.layers_dragging.extend(parent_selected.iter().copied());
					}
					responses.add(NodeGraphMessage::SelectedNodesSet {
						nodes: tool_data
							.layers_dragging
							.iter()
							.filter_map(|layer| {
								if *layer != LayerNodeIdentifier::ROOT_PARENT {
									Some(layer.to_node())
								} else {
									log::error!("ROOT_PARENT cannot be part of tool_data.layers_dragging");
									None
								}
							})
							.collect(),
					});
				}
				responses.add(OverlaysMessage::Draw);

				let selection = tool_data.nested_selection_behavior;
				SelectToolFsmState::Ready { selection }
			}