MCPcopy Create free account
hub / github.com/Moosync/Moosync / update_zoom

Method update_zoom

src-tauri/src/window/handler.rs:76–104  ·  view source on GitHub ↗
(&self, app: AppHandle, preference: State<PreferenceConfig>)

Source from the content-addressed store, hash-verified

74
75 #[tracing::instrument(level = "debug", skip(self, app, preference))]
76 pub fn update_zoom(&self, app: AppHandle, preference: State<PreferenceConfig>) -> Result<()> {
77 let scale_factor: f64 = preference.load_selective("zoomFactor".into())?;
78 let windows = app.webview_windows();
79 for window in windows.values() {
80 window.with_webview(move |webview| {
81 #[cfg(target_os = "linux")]
82 {
83 // see https://docs.rs/webkit2gtk/0.18.2/webkit2gtk/struct.WebView.html
84 // and https://docs.rs/webkit2gtk/0.18.2/webkit2gtk/trait.WebViewExt.html
85 use webkit2gtk::WebViewExt;
86 webview.inner().set_zoom_level(scale_factor);
87 }
88
89 #[cfg(windows)]
90 unsafe {
91 // see https://docs.rs/webview2-com/0.19.1/webview2_com/Microsoft/Web/WebView2/Win32/struct.ICoreWebView2Controller.html
92 webview.controller().SetZoomFactor(scale_factor).unwrap();
93 }
94
95 // #[cfg(target_os = "macos")]
96 // unsafe {
97 // use objc::{sel, sel_impl};
98 // let () = objc::msg_send![webview.inner(), setPageZoom: scale_factor];
99 // }
100 })?;
101 }
102
103 Ok(())
104 }
105
106 #[tracing::instrument(level = "debug", skip(self, url))]
107 pub fn open_external(&self, app: AppHandle, url: String) -> Result<()> {

Callers

nothing calls this directly

Calls 1

load_selectiveMethod · 0.80

Tested by

no test coverage detected