@@ -2750,15 +2750,23 @@ impl NodeNetworkInterface {
27502750 log:: error!( "Could not get nested network_metadata in collect_frontend_click_targets" ) ;
27512751 return FrontendClickTargets :: default ( ) ;
27522752 } ;
2753- network_metadata. persistent_metadata . node_metadata . keys ( ) . copied ( ) . collect :: < Vec < _ > > ( ) . into_iter ( ) . for_each ( |node_id| {
2754- if let ( Some ( import_export_click_targets) , Some ( node_click_targets) ) = ( self . import_export_ports ( network_path) . cloned ( ) , self . node_click_targets ( & node_id, network_path) ) {
2753+ let nodes = network_metadata. persistent_metadata . node_metadata . keys ( ) . copied ( ) . collect :: < Vec < _ > > ( ) ;
2754+ if let Some ( import_export_click_targets) = self . import_export_ports ( network_path) . cloned ( ) {
2755+ for port in import_export_click_targets. click_targets ( ) {
2756+ if let ClickTargetType :: Subpath ( subpath) = port. target_type ( ) {
2757+ connector_click_targets. push ( subpath. to_bezpath ( ) . to_svg ( ) ) ;
2758+ }
2759+ }
2760+ }
2761+ nodes. into_iter ( ) . for_each ( |node_id| {
2762+ if let Some ( node_click_targets) = self . node_click_targets ( & node_id, network_path) {
27552763 let mut node_path = String :: new ( ) ;
27562764
27572765 if let ClickTargetType :: Subpath ( subpath) = node_click_targets. node_click_target . target_type ( ) {
27582766 node_path. push_str ( subpath. to_bezpath ( ) . to_svg ( ) . as_str ( ) )
27592767 }
27602768 all_node_click_targets. push ( ( node_id, node_path) ) ;
2761- for port in node_click_targets. port_click_targets . click_targets ( ) . chain ( import_export_click_targets . click_targets ( ) ) {
2769+ for port in node_click_targets. port_click_targets . click_targets ( ) {
27622770 if let ClickTargetType :: Subpath ( subpath) = port. target_type ( ) {
27632771 connector_click_targets. push ( subpath. to_bezpath ( ) . to_svg ( ) ) ;
27642772 }
@@ -2925,19 +2933,18 @@ impl NodeNetworkInterface {
29252933 . collect :: < Vec < _ > > ( )
29262934 . iter ( )
29272935 . filter_map ( |node_id| {
2928- self . node_click_targets ( node_id, network_path)
2929- . and_then ( |transient_node_metadata| {
2930- transient_node_metadata
2931- . port_click_targets
2932- . clicked_input_port_from_point ( point)
2933- . map ( |port| InputConnector :: node ( * node_id, port) )
2934- } )
2935- . or_else ( || {
2936- self . import_export_ports ( network_path)
2937- . and_then ( |import_export_ports| import_export_ports. clicked_input_port_from_point ( point) . map ( InputConnector :: Export ) )
2938- } )
2936+ self . node_click_targets ( node_id, network_path) . and_then ( |transient_node_metadata| {
2937+ transient_node_metadata
2938+ . port_click_targets
2939+ . clicked_input_port_from_point ( point)
2940+ . map ( |port| InputConnector :: node ( * node_id, port) )
2941+ } )
29392942 } )
29402943 . next ( )
2944+ . or_else ( || {
2945+ self . import_export_ports ( network_path)
2946+ . and_then ( |import_export_ports| import_export_ports. clicked_input_port_from_point ( point) . map ( InputConnector :: Export ) )
2947+ } )
29412948 }
29422949
29432950 pub fn output_connector_from_click ( & mut self , click : DVec2 , network_path : & [ NodeId ] ) -> Option < OutputConnector > {
@@ -2955,19 +2962,18 @@ impl NodeNetworkInterface {
29552962 nodes
29562963 . iter ( )
29572964 . filter_map ( |node_id| {
2958- self . node_click_targets ( node_id, network_path)
2959- . and_then ( |transient_node_metadata| {
2960- transient_node_metadata
2961- . port_click_targets
2962- . clicked_output_port_from_point ( point)
2963- . map ( |output_index| OutputConnector :: node ( * node_id, output_index) )
2964- } )
2965- . or_else ( || {
2966- self . import_export_ports ( network_path)
2967- . and_then ( |import_export_ports| import_export_ports. clicked_output_port_from_point ( point) . map ( OutputConnector :: Import ) )
2968- } )
2965+ self . node_click_targets ( node_id, network_path) . and_then ( |transient_node_metadata| {
2966+ transient_node_metadata
2967+ . port_click_targets
2968+ . clicked_output_port_from_point ( point)
2969+ . map ( |output_index| OutputConnector :: node ( * node_id, output_index) )
2970+ } )
29692971 } )
29702972 . next ( )
2973+ . or_else ( || {
2974+ self . import_export_ports ( network_path)
2975+ . and_then ( |import_export_ports| import_export_ports. clicked_output_port_from_point ( point) . map ( OutputConnector :: Import ) )
2976+ } )
29712977 }
29722978
29732979 pub fn input_position ( & mut self , input_connector : & InputConnector , network_path : & [ NodeId ] ) -> Option < DVec2 > {
0 commit comments