ratatui_toolkit/primitives/resizable_split/
mod.rs

1//! Resizable split component
2//!
3//! Provides resizable split panels with mouse drag support.
4
5pub mod constructors;
6pub mod methods;
7pub mod traits;
8
9/// Direction of split
10#[derive(Debug, Clone, Copy, PartialEq, Eq)]
11pub enum SplitDirection {
12    /// Vertical split (left/right panels) - divider is vertical, mouse drags horizontally
13    Vertical,
14    /// Horizontal split (top/bottom panels) - divider is horizontal, mouse drags vertically
15    Horizontal,
16}
17
18/// Tracks state of a resizable split
19#[derive(Debug, Clone)]
20pub struct ResizableSplit {
21    /// Current split position as percentage (0-100)
22    pub split_percent: u16,
23    /// Minimum percentage for first panel (left or top)
24    pub min_percent: u16,
25    /// Maximum percentage for first panel (left or top)
26    pub max_percent: u16,
27    /// Whether currently dragging divider
28    pub is_dragging: bool,
29    /// Whether mouse is hovering over divider
30    pub is_hovering: bool,
31    /// Direction of split
32    pub direction: SplitDirection,
33    /// The column or row position of divider (updated each frame)
34    pub divider_pos: u16,
35}