Skip to main content

fret_ui/tree/debug/
layers.rs

1use super::super::*;
2
3/// Controls whether an overlay layer prevents pointer interactions from reaching layers beneath it.
4///
5/// This is a *mechanism* only. Policy lives in ecosystem crates (e.g. `fret-ui-kit`), which decide
6/// when to enable occlusion (Radix `disableOutsidePointerEvents` outcomes, editor interaction
7/// arbitration, etc.).
8#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
9pub enum PointerOcclusion {
10    /// No occlusion; pointer events route normally via hit-testing across layers.
11    #[default]
12    None,
13    /// Blocks pointer interaction (hover/move/down/up) for layers beneath the occluding layer.
14    BlockMouse,
15    /// Blocks pointer interaction for layers beneath the occluding layer, but allows scroll wheel
16    /// to route to underlay scroll targets.
17    BlockMouseExceptScroll,
18}
19
20#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
21pub struct UiInputArbitrationSnapshot {
22    pub modal_barrier_root: Option<NodeId>,
23    pub focus_barrier_root: Option<NodeId>,
24    pub pointer_occlusion: PointerOcclusion,
25    pub pointer_occlusion_layer: Option<UiLayerId>,
26    pub pointer_capture_active: bool,
27    /// When all captured pointers belong to the same layer, this reports that layer.
28    ///
29    /// If captures span multiple layers (or a captured node cannot be mapped to a layer), this is
30    /// `None` and `pointer_capture_multiple_layers=true`.
31    pub pointer_capture_layer: Option<UiLayerId>,
32    pub pointer_capture_multiple_layers: bool,
33}
34
35#[derive(Debug, Clone)]
36pub struct UiDebugLayerInfo {
37    pub id: UiLayerId,
38    pub root: NodeId,
39    pub visible: bool,
40    pub blocks_underlay_input: bool,
41    pub hit_testable: bool,
42    pub pointer_occlusion: PointerOcclusion,
43    pub wants_pointer_down_outside_events: bool,
44    pub consume_pointer_down_outside_events: bool,
45    pub pointer_down_outside_branches: Vec<NodeId>,
46    pub wants_pointer_move_events: bool,
47    pub wants_timer_events: bool,
48}
49
50#[derive(Debug, Clone)]
51pub struct UiDebugHitTest {
52    pub hit: Option<NodeId>,
53    pub active_layer_roots: Vec<NodeId>,
54    pub barrier_root: Option<NodeId>,
55}