Skip to main content

jellyflow_runtime/runtime/utils/
options.rs

1use jellyflow_core::core::CanvasSize;
2
3#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
4pub enum NodeInclusion {
5    /// Include nodes that intersect the query rect.
6    Partial,
7    /// Include nodes only when fully contained within the query rect.
8    Full,
9}
10
11#[derive(Debug, Clone, Copy)]
12pub struct GetNodesBoundsOptions {
13    /// Node origin (anchor) used to interpret `Node.pos`.
14    ///
15    /// - `(0.0, 0.0)` means `pos` is top-left.
16    /// - `(0.5, 0.5)` means `pos` is center.
17    pub node_origin: (f32, f32),
18    /// Whether to include hidden nodes.
19    pub include_hidden: bool,
20    /// Fallback size to use when a node has no explicit size.
21    ///
22    /// When `None`, nodes without a size are skipped.
23    pub fallback_size: Option<CanvasSize>,
24}
25
26impl Default for GetNodesBoundsOptions {
27    fn default() -> Self {
28        Self {
29            node_origin: (0.0, 0.0),
30            include_hidden: false,
31            fallback_size: None,
32        }
33    }
34}
35
36#[derive(Debug, Clone, Copy)]
37pub struct GetNodesInsideOptions {
38    pub inclusion: NodeInclusion,
39    pub node_origin: (f32, f32),
40    pub include_hidden: bool,
41    pub fallback_size: Option<CanvasSize>,
42}
43
44impl Default for GetNodesInsideOptions {
45    fn default() -> Self {
46        Self {
47            inclusion: NodeInclusion::Partial,
48            node_origin: (0.0, 0.0),
49            include_hidden: false,
50            fallback_size: None,
51        }
52    }
53}