how can i modify the window size while app is running #12079
Answered
by
FabianLars
Jim-Lin-4549
asked this question in
Q&A
-
the code: // frontend
import { getCurrentWindow, LogicalSize } from "@tauri-apps/api/window";
const $appWindow = getCurrentWindow();
const handler1 = () => {
$appWindow.setSize(new LogicalSize(700, 500))
} // backend
#[tauri::command]
async fn enlarge_window(window: Window) {
let size = window.inner_size().expect("Failed to get window size");
let start_width = size.width;
let start_height = size.height;
let target_width = 1689;
let target_height = size.height;
let duration = Duration::from_millis(100);
let steps = 50;
for i in 1..=steps {
let current_width = start_width + ((target_width - start_width) * i / steps);
let current_height = start_height + ((target_height - start_height) * i / steps);
window
.set_size(tauri::PhysicalSize {
width: current_width,
height: current_height,
})
.expect("Failed to set window size");
sleep(duration / steps).await;
}
} neither doesn't run any more. extra infomation (`tauri info`)
|
Beta Was this translation helpful? Give feedback.
Answered by
FabianLars
Dec 31, 2024
Replies: 1 comment 1 reply
-
does your window has decorations disabled? If so, then this should be fixed on the next release. |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
Jim-Lin-4549
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
does your window has decorations disabled? If so, then this should be fixed on the next release.