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;
|
use serde::Deserialize;
|
||||||
|
|
||||||
#[derive(Clone, Copy, Default, Deserialize)]
|
#[derive(Clone, Copy, Default, Deserialize, PartialEq, Eq)]
|
||||||
pub enum Origin {
|
pub enum Origin {
|
||||||
#[default]
|
#[default]
|
||||||
#[serde(rename = "top-left")]
|
#[serde(rename = "top-left")]
|
||||||
|
|
|
||||||
|
|
@ -26,13 +26,18 @@ impl Ctx {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn area(&self, pos: &Position) -> Rect {
|
pub fn area(&self, position: &Position) -> Rect {
|
||||||
// TODO: hovered
|
if position.origin != Origin::Hovered {
|
||||||
if let Origin::Hovered = pos.origin {
|
return position.rect();
|
||||||
return Rect::default();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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]
|
#[inline]
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue