Add: config for controlling debug overlay visibility of tauri
This commit is contained in:
@@ -121,6 +121,26 @@ fn load_active_sprite_pack(state: tauri::State<'_, AppState>) -> Result<UiSprite
|
||||
})
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
fn debug_overlay_visible(state: tauri::State<'_, AppState>) -> Result<bool, String> {
|
||||
state
|
||||
.runtime_core
|
||||
.frontend_debug_overlay_visible()
|
||||
.map_err(|err| err.to_string())
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
fn set_debug_overlay_visible(
|
||||
state: tauri::State<'_, AppState>,
|
||||
visible: bool,
|
||||
) -> Result<bool, String> {
|
||||
state
|
||||
.runtime_core
|
||||
.set_frontend_debug_overlay_visible(visible)
|
||||
.map_err(|err| err.to_string())?;
|
||||
Ok(visible)
|
||||
}
|
||||
|
||||
fn main() -> Result<(), AppError> {
|
||||
tracing_subscriber::fmt()
|
||||
.with_env_filter("sprimo=info")
|
||||
@@ -141,7 +161,12 @@ fn main() -> Result<(), AppError> {
|
||||
tauri::Builder::default()
|
||||
.plugin(tauri_plugin_global_shortcut::Builder::new().build())
|
||||
.manage(state)
|
||||
.invoke_handler(tauri::generate_handler![current_state, load_active_sprite_pack])
|
||||
.invoke_handler(tauri::generate_handler![
|
||||
current_state,
|
||||
load_active_sprite_pack,
|
||||
debug_overlay_visible,
|
||||
set_debug_overlay_visible
|
||||
])
|
||||
.setup(|app| {
|
||||
let app_state: tauri::State<'_, AppState> = app.state();
|
||||
let runtime_core = Arc::clone(&app_state.runtime_core);
|
||||
|
||||
Reference in New Issue
Block a user