1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
use super::*;
/// Deterministic single-source-of-truth gesture arbitration state machine enforcing strict input priority tiers.
#[derive(Clone, Data, Debug)]
pub(crate) struct GestureArena {
/// Active exclusive gesture owner (`Idle` when no pointer sequence is underway).
#[get(pub(crate), type(copy))]
#[set(pub(crate))]
pub(crate) active: ActiveGesture,
/// Primary pointer identifier currently arbitrated by the arena.
#[get(skip)]
#[set(pub(crate))]
pub(crate) primary_pointer_id: Option<u64>,
/// Input device class of the primary contact.
#[get(pub(crate), type(copy))]
#[set(pub(crate))]
pub(crate) primary_device: PointerDevice,
/// Logical coordinates where the primary contact started.
#[get(pub(crate), type(copy))]
#[set(pub(crate))]
pub(crate) origin: Point,
/// Most recently observed logical coordinates for the primary contact.
#[get(pub(crate), type(copy))]
#[set(pub(crate))]
pub(crate) last_pos: Point,
/// Leaf scene node initially hit at `PointerDown`.
#[get(skip)]
#[set(pub(crate))]
pub(crate) origin_hit: Option<NodeId>,
/// Interactive scene node pressed at `PointerDown`.
#[get(skip)]
#[set(pub(crate))]
pub(crate) pressed_target: Option<NodeId>,
/// Eligible direct-drag control (`Canvas` or `on_pointer_down` + `on_pointer_move`) under `origin_hit`.
#[get(skip)]
#[set(pub(crate))]
pub(crate) direct_drag_target: Option<NodeId>,
/// Tier 0 topmost visible `Portal` or `Position::Fixed` barrier enclosing `origin_hit`, if any.
#[get(skip)]
#[set(pub(crate))]
pub(crate) overlay_barrier: Option<NodeId>,
/// Whether `Click` and `Tap` emission must be suppressed when the current pointer sequence ends.
#[get(pub(crate), type(copy))]
#[set(pub(crate))]
pub(crate) suppress_click: bool,
/// Whether this touch sequence arrested an active inertial scroll fling on `PointerDown`.
#[get(pub(crate), type(copy))]
#[set(pub(crate))]
pub(crate) arrested_fling: bool,
/// Whether horizontal route swipe is permitted when no horizontal scroll ancestor claims the drag.
#[get(pub(crate), type(copy))]
#[set(pub(crate))]
pub(crate) route_swipe_allowed: bool,
/// Monotonic runtime timestamp in milliseconds recorded at `PointerDown`.
#[get(pub(crate), type(copy))]
#[set(pub(crate))]
pub(crate) started_ms: u64,
/// Remaining wheel/trackpad scroll-burst isolation cooldown in seconds suppressing hover churn.
#[get(pub(crate), type(copy))]
#[set(pub(crate))]
pub(crate) wheel_isolation_secs: f32,
/// Per-pointer elapsed idle seconds since the last down or move event for stale-contact recovery.
#[get(pub(crate))]
#[get_mut(pub(crate))]
#[set(pub(crate))]
pub(crate) pointer_idle_secs: HashMap<u64, f32>,
/// Whether a Tier 3 deferred focus transition is queued awaiting clean tap release (cancelled if scroll/swipe/pinch wins).
#[get(pub(crate), type(copy))]
#[set(pub(crate))]
pub(crate) pending_focus_active: bool,
/// Deferred focus target captured at `PointerDown` for touch/stylus or scroll-isolated contacts (`None` blurs on clean tap).
#[get(skip)]
#[set(pub(crate))]
pub(crate) pending_focus_target: Option<NodeId>,
/// Logical coordinates where the deferred focus contact started.
#[get(pub(crate), type(copy))]
#[set(pub(crate))]
pub(crate) pending_focus_pos: Point,
/// Whether `pending_focus_target` refers to an enabled editable `NodeKind::Input`.
#[get(pub(crate), type(copy))]
#[set(pub(crate))]
pub(crate) pending_focus_is_input: bool,
}
/// Scene-resolved targets and callbacks computed inside a single `PointerDown` write borrow.
#[derive(Default)]
pub(crate) struct PointerDownPlan {
/// Callbacks (`PointerEnter`, `PointerLeave`, `Focus`, `Blur`, `PointerDown`, virtual `Scroll`) to invoke outside the tree borrow.
pub(crate) callbacks: Vec<(UiEventHandler, UiEvent)>,
/// Scrollbar drag axis when a desktop scrollbar track was grabbed (`SCROLLBAR_AXIS_NONE` otherwise).
pub(crate) scrollbar_axis: u8,
/// Scrollbar container node handle when `scrollbar_axis != SCROLLBAR_AXIS_NONE`.
pub(crate) scrollbar_node: Option<NodeId>,
/// Whether the press landed on an enabled editable `NodeKind::Input`.
pub(crate) tapped_enabled_input: bool,
/// Started text-selection metadata for primary desktop text clicks.
pub(crate) text_sel_started: Option<(NodeId, usize, u8, bool)>,
/// Leaf scene node initially hit by `hit_test`.
pub(crate) origin_hit: Option<NodeId>,
/// Interactive node marked pressed on `PointerDown`.
pub(crate) press_target: Option<NodeId>,
/// Eligible direct-drag control (`Canvas` or `on_pointer_down` + `on_pointer_move`) under `origin_hit`.
pub(crate) direct_drag_target: Option<NodeId>,
/// Enclosing Tier 0 `Portal` or `Position::Fixed` barrier, if any.
pub(crate) overlay_barrier: Option<NodeId>,
/// Whether horizontal route swipe is permitted if no horizontal scroll container claims the drag.
pub(crate) route_swipe_allowed: bool,
/// Whether global `Context::gesture` synthesis should be suppressed for this contact (canvas, direct drag, stop propagation).
pub(crate) suppress_global_gestures: bool,
/// Whether this press landed inside an actively flinging scroll container and arrested inertial momentum.
pub(crate) arrested_fling: bool,
/// Whether focus & IME activation were deferred to clean `PointerUp` to prevent scroll-triggered keyboard popups.
pub(crate) deferred_focus_active: bool,
/// Deferred focus target (`Some(node)` to focus, `None` to blur) when `deferred_focus_active` is `true`.
pub(crate) deferred_focus_target: Option<NodeId>,
}