File tree Expand file tree Collapse file tree 1 file changed +22
-13
lines changed
editor/src/messages/portfolio/document/node_graph Expand file tree Collapse file tree 1 file changed +22
-13
lines changed Original file line number Diff line number Diff line change @@ -1847,24 +1847,33 @@ impl NodeGraphMessageHandler {
1847
1847
_ => None ,
1848
1848
} ;
1849
1849
1850
+ let single_layer_selected = selection_includes_layers && !has_multiple_selection;
1851
+
1850
1852
let mut node_chooser = NodeCatalog :: new( ) ;
1851
1853
node_chooser. intial_search = compatible_type. unwrap_or( "" . to_string( ) ) ;
1852
1854
1853
1855
let node_chooser = node_chooser
1854
1856
. on_update( move |node_type| {
1855
- let node_id = NodeId :: new( ) ;
1856
-
1857
- Message :: Batched {
1858
- messages: Box :: new( [
1859
- NodeGraphMessage :: CreateNodeFromContextMenu {
1860
- node_id: Some ( node_id) ,
1861
- node_type: node_type. clone( ) ,
1862
- xy: None ,
1863
- add_transaction: true ,
1864
- }
1865
- . into( ) ,
1866
- NodeGraphMessage :: SelectedNodesSet { nodes: vec![ node_id] } . into( ) ,
1867
- ] ) ,
1857
+ if let ( true , Some ( layer) ) = ( single_layer_selected, selected_layer) {
1858
+ NodeGraphMessage :: CreateNodeInLayerWithTransaction {
1859
+ node_type: node_type. clone( ) ,
1860
+ layer: LayerNodeIdentifier :: new_unchecked( layer. to_node( ) ) ,
1861
+ }
1862
+ . into( )
1863
+ } else {
1864
+ let node_id = NodeId :: new( ) ;
1865
+ Message :: Batched {
1866
+ messages: Box :: new( [
1867
+ NodeGraphMessage :: CreateNodeFromContextMenu {
1868
+ node_id: Some ( node_id) ,
1869
+ node_type: node_type. clone( ) ,
1870
+ xy: None ,
1871
+ add_transaction: true ,
1872
+ }
1873
+ . into( ) ,
1874
+ NodeGraphMessage :: SelectedNodesSet { nodes: vec![ node_id] } . into( ) ,
1875
+ ] ) ,
1876
+ }
1868
1877
}
1869
1878
} )
1870
1879
. widget_holder( ) ;
You can’t perform that action at this time.
0 commit comments