@@ -12,7 +12,7 @@ use glam::{DAffine2, DVec2, IVec2};
1212use  graph_craft:: document:: value:: TaggedValue ; 
1313use  graph_craft:: document:: { DocumentNode ,  DocumentNodeImplementation ,  NodeId ,  NodeInput ,  NodeNetwork ,  OldDocumentNodeImplementation ,  OldNodeNetwork } ; 
1414use  graph_craft:: { Type ,  concrete} ; 
15- use  graphene_std:: renderer:: { ClickTarget ,  Quad } ; 
15+ use  graphene_std:: renderer:: { ClickTarget ,  ClickTargetType ,   Quad } ; 
1616use  graphene_std:: transform:: Footprint ; 
1717use  graphene_std:: vector:: { PointId ,  VectorData ,  VectorModificationType } ; 
1818use  interpreted_executor:: dynamic_executor:: ResolvedDocumentNodeTypes ; 
@@ -2120,7 +2120,7 @@ impl NodeNetworkInterface {
21202120			let  bounding_box_top_right = DVec2 :: new ( ( all_nodes_bounding_box[ 1 ] . x  / 24.  + 0.5 ) . floor ( )  *  24. ,  ( all_nodes_bounding_box[ 0 ] . y  / 24.  + 0.5 ) . floor ( )  *  24. )  + offset_from_top_right; 
21212121			let  export_top_right:  DVec2  = DVec2 :: new ( viewport_top_right. x . max ( bounding_box_top_right. x ) ,  viewport_top_right. y . min ( bounding_box_top_right. y ) ) ; 
21222122			let  add_export_center = export_top_right + DVec2 :: new ( 0. ,  network. exports . len ( )  as  f64  *  24. ) ; 
2123- 			let  add_export = ClickTarget :: new ( 
2123+ 			let  add_export = ClickTarget :: new_with_subpath ( 
21242124				Subpath :: new_rounded_rect ( add_export_center - DVec2 :: new ( 12. ,  12. ) ,  add_export_center + DVec2 :: new ( 12. ,  12. ) ,  [ 3. ;  4 ] ) , 
21252125				0. , 
21262126			) ; 
@@ -2146,7 +2146,7 @@ impl NodeNetworkInterface {
21462146			let  bounding_box_top_left = DVec2 :: new ( ( all_nodes_bounding_box[ 0 ] . x  / 24.  + 0.5 ) . floor ( )  *  24. ,  ( all_nodes_bounding_box[ 0 ] . y  / 24.  + 0.5 ) . floor ( )  *  24. )  + offset_from_top_left; 
21472147			let  import_top_left = DVec2 :: new ( viewport_top_left. x . min ( bounding_box_top_left. x ) ,  viewport_top_left. y . min ( bounding_box_top_left. y ) ) ; 
21482148			let  add_import_center = import_top_left + DVec2 :: new ( 0. ,  self . number_of_displayed_imports ( network_path)  as  f64  *  24. ) ; 
2149- 			let  add_import = ClickTarget :: new ( 
2149+ 			let  add_import = ClickTarget :: new_with_subpath ( 
21502150				Subpath :: new_rounded_rect ( add_import_center - DVec2 :: new ( 12. ,  12. ) ,  add_import_center + DVec2 :: new ( 12. ,  12. ) ,  [ 3. ;  4 ] ) , 
21512151				0. , 
21522152			) ; 
@@ -2165,8 +2165,8 @@ impl NodeNetworkInterface {
21652165				let  reorder_import_center = ( import_bounding_box[ 0 ]  + import_bounding_box[ 1 ] )  / 2.  + DVec2 :: new ( -12. ,  0. ) ; 
21662166				let  remove_import_center = reorder_import_center + DVec2 :: new ( -12. ,  0. ) ; 
21672167
2168- 				let  reorder_import = ClickTarget :: new ( Subpath :: new_rect ( reorder_import_center - DVec2 :: new ( 3. ,  4. ) ,  reorder_import_center + DVec2 :: new ( 3. ,  4. ) ) ,  0. ) ; 
2169- 				let  remove_import = ClickTarget :: new ( Subpath :: new_rect ( remove_import_center - DVec2 :: new ( 8. ,  8. ) ,  remove_import_center + DVec2 :: new ( 8. ,  8. ) ) ,  0. ) ; 
2168+ 				let  reorder_import = ClickTarget :: new_with_subpath ( Subpath :: new_rect ( reorder_import_center - DVec2 :: new ( 3. ,  4. ) ,  reorder_import_center + DVec2 :: new ( 3. ,  4. ) ) ,  0. ) ; 
2169+ 				let  remove_import = ClickTarget :: new_with_subpath ( Subpath :: new_rect ( remove_import_center - DVec2 :: new ( 8. ,  8. ) ,  remove_import_center + DVec2 :: new ( 8. ,  8. ) ) ,  0. ) ; 
21702170
21712171				reorder_imports_exports. insert_custom_output_port ( * import_index,  reorder_import) ; 
21722172				remove_imports_exports. insert_custom_output_port ( * import_index,  remove_import) ; 
@@ -2180,8 +2180,8 @@ impl NodeNetworkInterface {
21802180				let  reorder_export_center = ( export_bounding_box[ 0 ]  + export_bounding_box[ 1 ] )  / 2.  + DVec2 :: new ( 12. ,  0. ) ; 
21812181				let  remove_export_center = reorder_export_center + DVec2 :: new ( 12. ,  0. ) ; 
21822182
2183- 				let  reorder_export = ClickTarget :: new ( Subpath :: new_rect ( reorder_export_center - DVec2 :: new ( 3. ,  4. ) ,  reorder_export_center + DVec2 :: new ( 3. ,  4. ) ) ,  0. ) ; 
2184- 				let  remove_export = ClickTarget :: new ( Subpath :: new_rect ( remove_export_center - DVec2 :: new ( 8. ,  8. ) ,  remove_export_center + DVec2 :: new ( 8. ,  8. ) ) ,  0. ) ; 
2183+ 				let  reorder_export = ClickTarget :: new_with_subpath ( Subpath :: new_rect ( reorder_export_center - DVec2 :: new ( 3. ,  4. ) ,  reorder_export_center + DVec2 :: new ( 3. ,  4. ) ) ,  0. ) ; 
2184+ 				let  remove_export = ClickTarget :: new_with_subpath ( Subpath :: new_rect ( remove_export_center - DVec2 :: new ( 8. ,  8. ) ,  remove_export_center + DVec2 :: new ( 8. ,  8. ) ) ,  0. ) ; 
21852185
21862186				reorder_imports_exports. insert_custom_input_port ( * export_index,  reorder_export) ; 
21872187				remove_imports_exports. insert_custom_input_port ( * export_index,  remove_export) ; 
@@ -2572,7 +2572,7 @@ impl NodeNetworkInterface {
25722572
25732573			let  radius = 3. ; 
25742574			let  subpath = bezier_rs:: Subpath :: new_rounded_rect ( node_click_target_top_left,  node_click_target_bottom_right,  [ radius;  4 ] ) ; 
2575- 			let  node_click_target = ClickTarget :: new ( subpath,  0. ) ; 
2575+ 			let  node_click_target = ClickTarget :: new_with_subpath ( subpath,  0. ) ; 
25762576
25772577			DocumentNodeClickTargets  { 
25782578				node_click_target, 
@@ -2597,12 +2597,12 @@ impl NodeNetworkInterface {
25972597			// Update visibility button click target 
25982598			let  visibility_offset = node_top_left + DVec2 :: new ( width as  f64 ,  24. ) ; 
25992599			let  subpath = Subpath :: new_rounded_rect ( DVec2 :: new ( -12. ,  -12. )  + visibility_offset,  DVec2 :: new ( 12. ,  12. )  + visibility_offset,  [ 3. ;  4 ] ) ; 
2600- 			let  visibility_click_target = ClickTarget :: new ( subpath,  0. ) ; 
2600+ 			let  visibility_click_target = ClickTarget :: new_with_subpath ( subpath,  0. ) ; 
26012601
26022602			// Update grip button click target, which is positioned to the left of the left most icon 
26032603			let  grip_offset_right_edge = node_top_left + DVec2 :: new ( width as  f64  - ( GRID_SIZE  as  f64 )  / 2. ,  24. ) ; 
26042604			let  subpath = Subpath :: new_rounded_rect ( DVec2 :: new ( -8. ,  -12. )  + grip_offset_right_edge,  DVec2 :: new ( 0. ,  12. )  + grip_offset_right_edge,  [ 0. ;  4 ] ) ; 
2605- 			let  grip_click_target = ClickTarget :: new ( subpath,  0. ) ; 
2605+ 			let  grip_click_target = ClickTarget :: new_with_subpath ( subpath,  0. ) ; 
26062606
26072607			// Create layer click target, which is contains the layer and the chain background 
26082608			let  chain_width_grid_spaces = self . chain_width ( node_id,  network_path) ; 
@@ -2611,7 +2611,7 @@ impl NodeNetworkInterface {
26112611			let  chain_top_left = node_top_left - DVec2 :: new ( ( chain_width_grid_spaces *  crate :: consts:: GRID_SIZE )  as  f64 ,  0. ) ; 
26122612			let  radius = 10. ; 
26132613			let  subpath = bezier_rs:: Subpath :: new_rounded_rect ( chain_top_left,  node_bottom_right,  [ radius;  4 ] ) ; 
2614- 			let  node_click_target = ClickTarget :: new ( subpath,  0. ) ; 
2614+ 			let  node_click_target = ClickTarget :: new_with_subpath ( subpath,  0. ) ; 
26152615
26162616			DocumentNodeClickTargets  { 
26172617				node_click_target, 
@@ -2804,20 +2804,29 @@ impl NodeNetworkInterface {
28042804			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) )  { 
28052805				let  mut  node_path = String :: new ( ) ; 
28062806
2807- 				let  _ = node_click_targets. node_click_target . subpath ( ) . subpath_to_svg ( & mut  node_path,  DAffine2 :: IDENTITY ) ; 
2807+ 				if  let  ClickTargetType :: Subpath ( subpath)  = node_click_targets. node_click_target . target_type ( )  { 
2808+ 					let  _ = subpath. subpath_to_svg ( & mut  node_path,  DAffine2 :: IDENTITY ) ; 
2809+ 				} 
28082810				all_node_click_targets. push ( ( node_id,  node_path) ) ; 
28092811				for  port in  node_click_targets. port_click_targets . click_targets ( ) . chain ( import_export_click_targets. click_targets ( ) )  { 
2810- 					let  mut  port_path = String :: new ( ) ; 
2811- 					let  _ = port. subpath ( ) . subpath_to_svg ( & mut  port_path,  DAffine2 :: IDENTITY ) ; 
2812- 					port_click_targets. push ( port_path) ; 
2812+ 					if  let  ClickTargetType :: Subpath ( subpath)  = port. target_type ( )  { 
2813+ 						let  mut  port_path = String :: new ( ) ; 
2814+ 						let  _ = subpath. subpath_to_svg ( & mut  port_path,  DAffine2 :: IDENTITY ) ; 
2815+ 						port_click_targets. push ( port_path) ; 
2816+ 					} 
28132817				} 
28142818				if  let  NodeTypeClickTargets :: Layer ( layer_metadata)  = & node_click_targets. node_type_metadata  { 
2815- 					let  mut  port_path = String :: new ( ) ; 
2816- 					let  _ = layer_metadata. visibility_click_target . subpath ( ) . subpath_to_svg ( & mut  port_path,  DAffine2 :: IDENTITY ) ; 
2817- 					icon_click_targets. push ( port_path) ; 
2818- 					let  mut  port_path = String :: new ( ) ; 
2819- 					let  _ = layer_metadata. grip_click_target . subpath ( ) . subpath_to_svg ( & mut  port_path,  DAffine2 :: IDENTITY ) ; 
2820- 					icon_click_targets. push ( port_path) ; 
2819+ 					if  let  ClickTargetType :: Subpath ( subpath)  = layer_metadata. visibility_click_target . target_type ( )  { 
2820+ 						let  mut  port_path = String :: new ( ) ; 
2821+ 						let  _ = subpath. subpath_to_svg ( & mut  port_path,  DAffine2 :: IDENTITY ) ; 
2822+ 						icon_click_targets. push ( port_path) ; 
2823+ 					} 
2824+ 
2825+ 					if  let  ClickTargetType :: Subpath ( subpath)  = layer_metadata. grip_click_target . target_type ( )  { 
2826+ 						let  mut  port_path = String :: new ( ) ; 
2827+ 						let  _ = subpath. subpath_to_svg ( & mut  port_path,  DAffine2 :: IDENTITY ) ; 
2828+ 						icon_click_targets. push ( port_path) ; 
2829+ 					} 
28212830				} 
28222831			} 
28232832		} ) ; 
@@ -2872,9 +2881,11 @@ impl NodeNetworkInterface {
28722881				. chain ( modify_import_export_click_targets. remove_imports_exports . click_targets ( ) ) 
28732882				. chain ( modify_import_export_click_targets. reorder_imports_exports . click_targets ( ) ) 
28742883			{ 
2875- 				let  mut  remove_string = String :: new ( ) ; 
2876- 				let  _ = click_target. subpath ( ) . subpath_to_svg ( & mut  remove_string,  DAffine2 :: IDENTITY ) ; 
2877- 				modify_import_export. push ( remove_string) ; 
2884+ 				if  let  ClickTargetType :: Subpath ( subpath)  = click_target. target_type ( )  { 
2885+ 					let  mut  remove_string = String :: new ( ) ; 
2886+ 					let  _ = subpath. subpath_to_svg ( & mut  remove_string,  DAffine2 :: IDENTITY ) ; 
2887+ 					modify_import_export. push ( remove_string) ; 
2888+ 				} 
28782889			} 
28792890		} 
28802891		FrontendClickTargets  { 
@@ -3174,8 +3185,8 @@ impl NodeNetworkInterface {
31743185		self . document_metadata 
31753186			. click_targets 
31763187			. get ( & layer) 
3177- 			. map ( |click| click. iter ( ) . map ( ClickTarget :: subpath ) ) 
3178- 			. map ( |subpaths | VectorData :: from_subpaths ( subpaths ,  true ) ) 
3188+ 			. map ( |click| click. iter ( ) . map ( ClickTarget :: target_type ) ) 
3189+ 			. map ( |target_types | VectorData :: from_target_types ( target_types ,  true ) ) 
31793190	} 
31803191
31813192	/// Loads the structure of layer nodes from a node graph. 
@@ -5893,7 +5904,7 @@ impl Ports {
58935904
58945905	fn  insert_input_port_at_center ( & mut  self ,  input_index :  usize ,  center :  DVec2 )  { 
58955906		let  subpath = Subpath :: new_ellipse ( center - DVec2 :: new ( 8. ,  8. ) ,  center + DVec2 :: new ( 8. ,  8. ) ) ; 
5896- 		self . insert_custom_input_port ( input_index,  ClickTarget :: new ( subpath,  0. ) ) ; 
5907+ 		self . insert_custom_input_port ( input_index,  ClickTarget :: new_with_subpath ( subpath,  0. ) ) ; 
58975908	} 
58985909
58995910	fn  insert_custom_input_port ( & mut  self ,  input_index :  usize ,  click_target :  ClickTarget )  { 
@@ -5902,7 +5913,7 @@ impl Ports {
59025913
59035914	fn  insert_output_port_at_center ( & mut  self ,  output_index :  usize ,  center :  DVec2 )  { 
59045915		let  subpath = Subpath :: new_ellipse ( center - DVec2 :: new ( 8. ,  8. ) ,  center + DVec2 :: new ( 8. ,  8. ) ) ; 
5905- 		self . insert_custom_output_port ( output_index,  ClickTarget :: new ( subpath,  0. ) ) ; 
5916+ 		self . insert_custom_output_port ( output_index,  ClickTarget :: new_with_subpath ( subpath,  0. ) ) ; 
59065917	} 
59075918
59085919	fn  insert_custom_output_port ( & mut  self ,  output_index :  usize ,  click_target :  ClickTarget )  { 
0 commit comments