dioxus/examples/window_zoom.rs
2024-01-04 19:02:00 -06:00

22 lines
494 B
Rust

use dioxus::prelude::*;
fn main() {
dioxus_desktop::launch(app);
}
fn app(cx: Scope) -> Element {
let level = use_state(cx, || 1.0);
cx.render(rsx! {
input {
r#type: "number",
value: "{level}",
oninput: |e| {
if let Ok(new_zoom) = e.value().parse::<f64>() {
level.set(new_zoom);
dioxus_desktop::window().webview.zoom(new_zoom);
}
}
}
})
}