feat: auto resize mini webview when main webview resized

This commit is contained in:
2024-04-15 13:30:55 +07:00
parent e3ede34108
commit 09b143cb08
14 changed files with 135 additions and 194 deletions

View File

@@ -66,3 +66,22 @@ pub fn reposition_column(
None => Err("Webview not found".into()),
}
}
#[tauri::command]
pub fn resize_column(
label: &str,
width: f32,
height: f32,
app_handle: tauri::AppHandle,
) -> Result<(), String> {
match app_handle.get_webview(label) {
Some(webview) => {
if let Ok(_) = webview.set_size(LogicalSize::new(width, height)) {
Ok(())
} else {
Err("Reposition column failed".into())
}
}
None => Err("Webview not found".into()),
}
}

View File

@@ -133,7 +133,8 @@ fn main() {
commands::opg::fetch_opg,
commands::window::create_column,
commands::window::close_column,
commands::window::reposition_column
commands::window::reposition_column,
commands::window::resize_column
])
.run(tauri::generate_context!())
.expect("error while running tauri application")