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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
//! Separator input registration and drag helpers.
//!
//! Provides:
//! - `register_separator` — register hit zone with the input coordinator
//! - `start_separator_drag` — capture drag-start state with constraints
//! - `update_separator_drag` — compute clamped new value from current cursor
//! - `end_separator_drag` — finalize and clear
//!
//! Double-click reset is NOT implemented: mlc has no double-click reset for
//! any separator variant (§3, §6 — no modifier / special gesture handlers found).
use crateLayerId;
use crate;
use crate;
use SeparatorDragState;
use SeparatorType;
// =============================================================================
// Separator kind for hit-zone sizing
// =============================================================================
/// Which mlc separator variant is being registered.
///
/// Determines the sense and hit-zone semantics passed to the coordinator.
/// Callers expand the `rect` to the appropriate hit zone before calling
/// `register_separator` — this enum tells the coordinator what interaction
/// to expect.
// =============================================================================
// register_separator
// =============================================================================
/// Register a separator widget with the input coordinator.
///
/// `kind` controls whether the registered sense is `NONE` (Divider) or
/// `DRAG` (ResizeHandle). The caller is responsible for expanding `rect` to
/// the correct hit-zone width/height before this call.
///
/// Equivalent to the existing `register` function but accepts a `SeparatorKind`
/// directly so callers do not need to construct a full `SeparatorType`.
/// Convenience wrapper over the original `SeparatorType`-based registration.
// =============================================================================
// start_separator_drag
// =============================================================================
/// Capture drag-start state for a separator resize handle.
///
/// `widget_id` — widget that was clicked / drag-started.
/// `cursor_pos` — cursor position along the separator axis (px).
/// `current_value` — current logical value of the separator
/// (e.g. `height_ratio * available_h` for sub-pane,
/// or absolute px offset for sidebar).
/// `target_pane_id` — opaque ID of the pane/leaf being resized.
/// `min_size` — minimum size (px) the resized pane must maintain.
/// `max_size` — maximum size (px) the resized pane may reach
/// (`None` = unbounded, caller computes from context).
// =============================================================================
// update_separator_drag
// =============================================================================
/// Compute clamped new separator value from the current cursor position.
///
/// Returns `None` when no drag is active (`state.field_id` is `None`).
/// Returns `Some(clamped_value)` otherwise.
///
/// Formula (matches mlc absolute-position model for sidebar / watchlist):
/// ```text
/// new_value = start_value + (cursor_pos - start_pos)
/// new_value = clamp(new_value, min_size_constraint, max_size_constraint)
/// ```
///
/// For delta-based paths (sub-pane, split-panel) the caller computes the
/// delta separately and does not need this function — it calls the crate-
/// specific drag handler directly.
// =============================================================================
// end_separator_drag
// =============================================================================
/// Finalize a separator drag and clear state.
///
/// Returns `Some((widget_id, final_value))` computed from the last cursor
/// position, or `None` if no drag was active.