jellyflow_runtime/io/config/state/views/
connection.rs1use jellyflow_core::interaction::NodeGraphConnectionMode;
2
3use crate::io::tuning::NodeGraphAutoPanTuning;
4use crate::runtime::geometry::EdgeHitTestOptions;
5
6use super::super::NodeGraphInteractionState;
7
8#[derive(Debug, Clone, Copy, PartialEq)]
10pub struct NodeGraphConnectionInteraction<'a> {
11 pub nodes_connectable: bool,
12 pub edges_reconnectable: bool,
13 pub connection_mode: NodeGraphConnectionMode,
14 pub connection_radius: f32,
15 pub reconnect_radius: f32,
16 pub reconnect_on_drop_empty: bool,
17 pub connection_drag_threshold: f32,
18 pub connect_on_click: bool,
19 pub reroute_on_edge_double_click: bool,
20 pub edge_insert_on_alt_drag: bool,
21 pub edge_hit_test: EdgeHitTestOptions,
22 pub auto_pan: &'a NodeGraphAutoPanTuning,
23}
24
25impl NodeGraphInteractionState {
26 pub fn connection_interaction(&self) -> NodeGraphConnectionInteraction<'_> {
27 NodeGraphConnectionInteraction {
28 nodes_connectable: self.nodes_connectable,
29 edges_reconnectable: self.edges_reconnectable,
30 connection_mode: self.connection_mode,
31 connection_radius: self.connection_radius,
32 reconnect_radius: self.reconnect_radius,
33 reconnect_on_drop_empty: self.reconnect_on_drop_empty,
34 connection_drag_threshold: self.connection_drag_threshold,
35 connect_on_click: self.connect_on_click,
36 reroute_on_edge_double_click: self.reroute_on_edge_double_click,
37 edge_insert_on_alt_drag: self.edge_insert_on_alt_drag,
38 edge_hit_test: self.edge_hit_test_options(),
39 auto_pan: &self.auto_pan,
40 }
41 }
42}