mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
..
This commit is contained in:
parent
944fa6767c
commit
420a6ddf18
2 changed files with 11 additions and 6 deletions
|
|
@ -1,6 +1,6 @@
|
|||
use serde::Deserialize;
|
||||
|
||||
#[derive(Clone, Copy, Default, Deserialize)]
|
||||
#[derive(Clone, Copy, Default, Deserialize, PartialEq, Eq)]
|
||||
pub enum Origin {
|
||||
#[default]
|
||||
#[serde(rename = "top-left")]
|
||||
|
|
|
|||
|
|
@ -26,13 +26,18 @@ impl Ctx {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn area(&self, pos: &Position) -> Rect {
|
||||
// TODO: hovered
|
||||
if let Origin::Hovered = pos.origin {
|
||||
return Rect::default();
|
||||
pub fn area(&self, position: &Position) -> Rect {
|
||||
if position.origin != Origin::Hovered {
|
||||
return position.rect();
|
||||
}
|
||||
|
||||
pos.rect()
|
||||
if let Some(r) =
|
||||
self.manager.hovered().and_then(|h| self.manager.current().rect_current(&h.url))
|
||||
{
|
||||
Position::sticky(r, position.offset)
|
||||
} else {
|
||||
Position::new(Origin::TopCenter, position.offset).rect()
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue