feat: use_window add set_zoom_level

This commit is contained in:
YuKun Liu committed 2022-05-11 14:49:46 +08:00
1 parent 8aadeff9d2
commit 4f55fcb84a
1 file changed
+9
+9
View File
@@ -115,6 +115,11 @@ impl DesktopContext {
let _ = self.proxy.send_event(SetDecorations(decoration)); let _ = self.proxy.send_event(SetDecorations(decoration));
} }
/// set window zoom level
pub fn set_zoom_level(&self, scale_factor: f64) {
let _ = self.proxy.send_event(SetZoomLevel(scale_factor));
}
/// opens DevTool window /// opens DevTool window
pub fn devtool(&self) { pub fn devtool(&self) {
let _ = self.proxy.send_event(DevTool); let _ = self.proxy.send_event(DevTool);
@@ -148,6 +153,8 @@ pub enum UserWindowEvent {
SetTitle(String), SetTitle(String),
SetDecorations(bool), SetDecorations(bool),
SetZoomLevel(f64),
DevTool, DevTool,
Eval(String), Eval(String),
@@ -191,6 +198,8 @@ pub(super) fn handler(
SetTitle(content) => window.set_title(&content), SetTitle(content) => window.set_title(&content),
SetDecorations(state) => window.set_decorations(state), SetDecorations(state) => window.set_decorations(state),
SetZoomLevel(scale_factor) => webview.zoom(scale_factor),
DevTool => {} DevTool => {}
Eval(code) => { Eval(code) => {