@@ -19,12 +19,15 @@ use crate::messages::tool::common_functionality::auto_panning::AutoPanning;
19
19
use crate :: messages:: tool:: common_functionality:: graph_modification_utils:: { self , get_clip_mode} ;
20
20
use crate :: messages:: tool:: tool_messages:: tool_prelude:: { Key , MouseMotion } ;
21
21
use crate :: messages:: tool:: utility_types:: { HintData , HintGroup , HintInfo } ;
22
+ use bezier_rs:: Subpath ;
22
23
use glam:: { DAffine2 , DVec2 , IVec2 } ;
23
24
use graph_craft:: document:: value:: TaggedValue ;
24
25
use graph_craft:: document:: { DocumentNodeImplementation , NodeId , NodeInput } ;
25
26
use graph_craft:: proto:: GraphErrors ;
26
27
use graphene_std:: math:: math_ext:: QuadExt ;
28
+ use graphene_std:: vector:: misc:: subpath_to_kurbo_bezpath;
27
29
use graphene_std:: * ;
30
+ use kurbo:: { Line , Point } ;
28
31
use renderer:: Quad ;
29
32
use std:: cmp:: Ordering ;
30
33
@@ -1242,9 +1245,37 @@ impl<'a> MessageHandler<NodeGraphMessage, NodeGraphMessageContext<'a>> for NodeG
1242
1245
}
1243
1246
log:: debug!( "preferences.graph_wire_style: {:?}" , preferences. graph_wire_style) ;
1244
1247
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) )
1246
1276
} )
1247
1277
. collect :: < Vec < _ > > ( ) ;
1278
+
1248
1279
// Prioritize vertical thick lines and cancel if there are multiple potential wires
1249
1280
let mut node_wires = Vec :: new ( ) ;
1250
1281
let mut stack_wires = Vec :: new ( ) ;
0 commit comments