This commit is contained in:
sxyazi 2023-10-23 11:31:35 +08:00
parent 218e9310e9
commit 391cf82cce
No known key found for this signature in database
4 changed files with 24 additions and 34 deletions

View file

@ -1,14 +1,9 @@
use std::cmp::max; use std::{cmp::max, path::PathBuf, process::Stdio};
use std::{path::PathBuf, process::Stdio};
use tracing::debug;
use anyhow::Result; use anyhow::Result;
use ratatui::prelude::Rect; use ratatui::prelude::Rect;
use tokio::{ use tokio::{io::AsyncWriteExt, process::{Child, Command}, sync::mpsc::{self, UnboundedSender}};
io::AsyncWriteExt, use tracing::debug;
process::{Child, Command},
sync::mpsc::{self, UnboundedSender},
};
use yazi_config::PREVIEW; use yazi_config::PREVIEW;
use crate::Adaptor; use crate::Adaptor;
@ -40,10 +35,8 @@ impl Ueberzug {
fn adjust_rect(mut rect: Rect) -> Rect { fn adjust_rect(mut rect: Rect) -> Rect {
let cfg = &PREVIEW.ueberzug; let cfg = &PREVIEW.ueberzug;
rect.x = rect.x = max((rect.x as f64 / cfg.scale_down_factor + cfg.x_offset) as i32, 0) as u16;
max((rect.x as f64 / cfg.scale_down_factor + cfg.x_offset) as i32, 0) as u16; rect.y = max((rect.y as f64 / cfg.scale_down_factor + cfg.y_offset) as i32, 0) as u16;
rect.y =
max((rect.y as f64 / cfg.scale_down_factor + cfg.y_offset) as i32, 0) as u16;
rect.width = rect.width =
max((rect.width as f64 / cfg.scale_down_factor + cfg.width_offset) as i32, 0) as u16; max((rect.width as f64 / cfg.scale_down_factor + cfg.width_offset) as i32, 0) as u16;
rect.height = rect.height =

View file

@ -1,7 +1,4 @@
use std::{ use std::{path::{Path, PathBuf}, time::{self, SystemTime}};
path::{Path, PathBuf},
time::{self, SystemTime},
};
use md5::{Digest, Md5}; use md5::{Digest, Md5};
use serde::Deserialize; use serde::Deserialize;