2022-05-12 00:03:42 +08:00
|
|
|
use dioxus::prelude::*;
|
2022-07-09 15:15:20 -04:00
|
|
|
use dioxus_desktop::use_window;
|
2022-05-12 00:03:42 +08:00
|
|
|
|
|
|
|
fn main() {
|
2022-07-09 15:15:20 -04:00
|
|
|
dioxus_desktop::launch(app);
|
2022-05-12 00:03:42 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
fn app(cx: Scope) -> Element {
|
2022-12-07 13:11:40 -08:00
|
|
|
let window = use_window(cx);
|
|
|
|
let level = use_state(cx, || 1.0);
|
2022-12-30 02:09:02 -05:00
|
|
|
|
2022-05-12 00:03:42 +08:00
|
|
|
cx.render(rsx! {
|
|
|
|
input {
|
|
|
|
r#type: "number",
|
2022-05-12 00:05:59 +08:00
|
|
|
value: "{level}",
|
2022-05-12 00:03:42 +08:00
|
|
|
oninput: |e| {
|
2022-12-30 02:32:53 -05:00
|
|
|
if let Ok(new_zoom) = e.value.parse::<f64>() {
|
|
|
|
level.set(new_zoom);
|
|
|
|
window.webview.zoom(new_zoom);
|
|
|
|
}
|
2022-05-12 00:03:42 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|