mirror of
https://github.com/sxyazi/yazi.git
synced 2024-12-20 15:21:59 +03:00
24 lines
420 B
Rust
24 lines
420 B
Rust
use ratatui::prelude::Rect;
|
|
|
|
#[derive(Default)]
|
|
pub enum Position {
|
|
#[default]
|
|
None,
|
|
Top(Rect),
|
|
Hovered(Rect),
|
|
}
|
|
|
|
impl Position {
|
|
#[inline]
|
|
pub fn rect(&self) -> Option<Rect> {
|
|
match self {
|
|
Position::None => None,
|
|
Position::Top(rect) => Some(*rect),
|
|
Position::Hovered(rect) => Some(*rect),
|
|
}
|
|
}
|
|
|
|
#[inline]
|
|
pub fn dimension(&self) -> Option<(u16, u16)> { self.rect().map(|r| (r.width, r.height)) }
|
|
}
|