build CONFIG_PATH more nicely and fix crash when minimizing with debug open
This commit is contained in:
+10
-5
@@ -26,10 +26,10 @@ use windows::Win32::Foundation::HANDLE;
|
|||||||
const THEME: catppuccin_egui::Theme = catppuccin_egui::MOCHA;
|
const THEME: catppuccin_egui::Theme = catppuccin_egui::MOCHA;
|
||||||
const WINDOW_SIZE: [f32; 2] = [240.0, 240.0];
|
const WINDOW_SIZE: [f32; 2] = [240.0, 240.0];
|
||||||
static CONFIG_PATH: LazyLock<PathBuf> = LazyLock::new(|| {
|
static CONFIG_PATH: LazyLock<PathBuf> = LazyLock::new(|| {
|
||||||
let mut config_path = dirs::config_local_dir().unwrap();
|
dirs::config_local_dir()
|
||||||
config_path.push("GTA Tools");
|
.unwrap()
|
||||||
config_path.push("config.json");
|
.join("GTA Tools")
|
||||||
config_path
|
.join("config.json")
|
||||||
});
|
});
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Serialize, Deserialize)]
|
||||||
@@ -129,7 +129,12 @@ impl eframe::App for App {
|
|||||||
self.debug = false;
|
self.debug = false;
|
||||||
}
|
}
|
||||||
if self.debug {
|
if self.debug {
|
||||||
let main_rect = ctx.input(|i| i.viewport().clone().outer_rect.unwrap());
|
let main_rect = ctx.input(|i| {
|
||||||
|
i.viewport()
|
||||||
|
.clone()
|
||||||
|
.outer_rect
|
||||||
|
.unwrap_or(egui::Rect::EVERYTHING)
|
||||||
|
});
|
||||||
let position = [main_rect.right(), main_rect.min.y];
|
let position = [main_rect.right(), main_rect.min.y];
|
||||||
ctx.show_viewport_immediate(
|
ctx.show_viewport_immediate(
|
||||||
egui::ViewportId::from_hash_of("debug_viewport"),
|
egui::ViewportId::from_hash_of("debug_viewport"),
|
||||||
|
|||||||
Reference in New Issue
Block a user