@@ -19,12 +19,15 @@ use crate::messages::tool::common_functionality::auto_panning::AutoPanning;
1919use  crate :: messages:: tool:: common_functionality:: graph_modification_utils:: { self ,  get_clip_mode} ; 
2020use  crate :: messages:: tool:: tool_messages:: tool_prelude:: { Key ,  MouseMotion } ; 
2121use  crate :: messages:: tool:: utility_types:: { HintData ,  HintGroup ,  HintInfo } ; 
22+ use  bezier_rs:: Subpath ; 
2223use  glam:: { DAffine2 ,  DVec2 ,  IVec2 } ; 
2324use  graph_craft:: document:: value:: TaggedValue ; 
2425use  graph_craft:: document:: { DocumentNodeImplementation ,  NodeId ,  NodeInput } ; 
2526use  graph_craft:: proto:: GraphErrors ; 
2627use  graphene_std:: math:: math_ext:: QuadExt ; 
28+ use  graphene_std:: vector:: misc:: subpath_to_kurbo_bezpath; 
2729use  graphene_std:: * ; 
30+ use  kurbo:: { Line ,  Point } ; 
2831use  renderer:: Quad ; 
2932use  std:: cmp:: Ordering ; 
3033
@@ -1242,9 +1245,37 @@ impl<'a> MessageHandler<NodeGraphMessage, NodeGraphMessageContext<'a>> for NodeG
12421245										} 
12431246										log:: debug!( "preferences.graph_wire_style: {:?}" ,  preferences. graph_wire_style) ; 
12441247										let  ( wire,  is_stack)  = network_interface. vector_wire_from_input ( & input,  preferences. graph_wire_style ,  selection_network_path) ?; 
1245- 										wire. rectangle_intersections_exist ( bounding_box[ 0 ] ,  bounding_box[ 1 ] ) . then_some ( ( input,  is_stack) ) 
1248+ 
1249+ 										let  bbox_rect = kurbo:: Rect :: new ( bounding_box[ 0 ] . x ,  bounding_box[ 0 ] . y ,  bounding_box[ 1 ] . x ,  bounding_box[ 1 ] . y ) ; 
1250+ 
1251+ 										let  p1 = DVec2 :: new ( bbox_rect. x0 ,  bbox_rect. y0 ) ; 
1252+ 										let  p2 = DVec2 :: new ( bbox_rect. x1 ,  bbox_rect. y0 ) ; 
1253+ 										let  p3 = DVec2 :: new ( bbox_rect. x1 ,  bbox_rect. y1 ) ; 
1254+ 										let  p4 = DVec2 :: new ( bbox_rect. x0 ,  bbox_rect. y1 ) ; 
1255+ 										let  ps = [ p1,  p2,  p3,  p4] ; 
1256+ 
1257+ 										let  inside = wire. is_inside_subpath ( & Subpath :: from_anchors_linear ( ps,  true ) ,  None ,  None ) ; 
1258+ 
1259+ 										let  wire = subpath_to_kurbo_bezpath ( wire) ; 
1260+ 
1261+ 										let  intersect = wire. segments ( ) . any ( |segment| { 
1262+ 											let  rect = kurbo:: Rect :: new ( bounding_box[ 0 ] . x ,  bounding_box[ 0 ] . y ,  bounding_box[ 1 ] . x ,  bounding_box[ 1 ] . y ) ; 
1263+ 
1264+ 											let  top_line = Line :: new ( Point :: new ( rect. x0 ,  rect. y0 ) ,  Point :: new ( rect. x1 ,  rect. y0 ) ) ; 
1265+ 											let  bottom_line = Line :: new ( Point :: new ( rect. x0 ,  rect. y1 ) ,  Point :: new ( rect. x1 ,  rect. y1 ) ) ; 
1266+ 											let  left_line = Line :: new ( Point :: new ( rect. x0 ,  rect. y0 ) ,  Point :: new ( rect. x0 ,  rect. y1 ) ) ; 
1267+ 											let  right_line = Line :: new ( Point :: new ( rect. x1 ,  rect. y0 ) ,  Point :: new ( rect. x1 ,  rect. y1 ) ) ; 
1268+ 
1269+ 											!segment. intersect_line ( top_line) . is_empty ( ) 
1270+ 												|| !segment. intersect_line ( bottom_line) . is_empty ( ) 
1271+ 												|| !segment. intersect_line ( left_line) . is_empty ( ) 
1272+ 												|| !segment. intersect_line ( right_line) . is_empty ( ) 
1273+ 										} ) ; 
1274+ 
1275+ 										( intersect || inside) . then_some ( ( input,  is_stack) ) 
12461276									} ) 
12471277									. collect :: < Vec < _ > > ( ) ; 
1278+ 
12481279								// Prioritize vertical thick lines and cancel if there are multiple potential wires 
12491280								let  mut  node_wires = Vec :: new ( ) ; 
12501281								let  mut  stack_wires = Vec :: new ( ) ; 
0 commit comments