move debug svelte into debug folder. also control panel UI

This commit is contained in:
2026-08-26 23:48:35 +08:00
parent 5916de9a91
commit daf374bf9e
11 changed files with 58 additions and 12 deletions
+35
View File
@@ -0,0 +1,35 @@
use tauri::{AppHandle, Manager, WebviewUrl};
const WINDOW_LABEL: &str = "control-panel";
pub fn init(handle: &AppHandle) {
if let Some(window) = handle.get_webview_window(WINDOW_LABEL) {
if !window.is_visible().unwrap() {
window.center().unwrap();
window.show().unwrap();
};
window.set_focus().unwrap();
return;
};
let builder = tauri::WebviewWindowBuilder::new(
handle,
WINDOW_LABEL,
WebviewUrl::App("/control-panel".into()),
)
.title("Wyd Control Panel")
.inner_size(400.0, 600.0)
.min_inner_size(400.0, 600.0)
.resizable(false)
.maximizable(false)
.visible(true);
let window = builder.build().unwrap();
let window_c = window.clone();
window.on_window_event(move |event: &tauri::WindowEvent| {
if let tauri::WindowEvent::CloseRequested { api, .. } = event {
api.prevent_close();
window_c.hide().unwrap();
}
});
}
+2
View File
@@ -1,5 +1,6 @@
use tauri::AppHandle;
mod control_panel;
#[cfg(debug_assertions)]
mod debug;
pub mod scene;
@@ -8,4 +9,5 @@ pub fn init(app_handle: &AppHandle) {
#[cfg(debug_assertions)]
debug::init(app_handle);
scene::init(app_handle);
control_panel::init(app_handle);
}