@@ -1351,48 +1351,46 @@ impl<R: Runtime> Webview<R> {
1351
1351
```rust,no_run
1352
1352
use tauri::Manager;
1353
1353
1354
- fn main() {
1355
- tauri::Builder::default()
1356
- .setup(|app| {
1357
- let main_webview = app.get_webview("main").unwrap();
1358
- main_webview.with_webview(|webview| {
1359
- #[cfg(target_os = "linux")]
1360
- {
1361
- // see <https://docs.rs/webkit2gtk/2.0.0/webkit2gtk/struct.WebView.html>
1362
- // and <https://docs.rs/webkit2gtk/2.0.0/webkit2gtk/trait.WebViewExt.html>
1363
- use webkit2gtk::WebViewExt;
1364
- webview.inner().set_zoom_level(4.);
1365
- }
1354
+ tauri::Builder::default()
1355
+ .setup(|app| {
1356
+ let main_webview = app.get_webview("main").unwrap();
1357
+ main_webview.with_webview(|webview| {
1358
+ #[cfg(target_os = "linux")]
1359
+ {
1360
+ // see <https://docs.rs/webkit2gtk/2.0.0/webkit2gtk/struct.WebView.html>
1361
+ // and <https://docs.rs/webkit2gtk/2.0.0/webkit2gtk/trait.WebViewExt.html>
1362
+ use webkit2gtk::WebViewExt;
1363
+ webview.inner().set_zoom_level(4.);
1364
+ }
1366
1365
1367
- #[cfg(windows)]
1368
- unsafe {
1369
- // see https://docs.rs/webview2-com/0.19.1/webview2_com/Microsoft/Web/WebView2/Win32/struct.ICoreWebView2Controller.html
1370
- webview.controller().SetZoomFactor(4.).unwrap();
1371
- }
1366
+ #[cfg(windows)]
1367
+ unsafe {
1368
+ // see https://docs.rs/webview2-com/0.19.1/webview2_com/Microsoft/Web/WebView2/Win32/struct.ICoreWebView2Controller.html
1369
+ webview.controller().SetZoomFactor(4.).unwrap();
1370
+ }
1372
1371
1373
- #[cfg(target_os = "macos")]
1374
- unsafe {
1375
- let view: &objc2_web_kit::WKWebView = &*webview.inner().cast();
1376
- let controller: &objc2_web_kit::WKUserContentController = &*webview.controller().cast();
1377
- let window: &objc2_app_kit::NSWindow = &*webview.ns_window().cast();
1372
+ #[cfg(target_os = "macos")]
1373
+ unsafe {
1374
+ let view: &objc2_web_kit::WKWebView = &*webview.inner().cast();
1375
+ let controller: &objc2_web_kit::WKUserContentController = &*webview.controller().cast();
1376
+ let window: &objc2_app_kit::NSWindow = &*webview.ns_window().cast();
1378
1377
1379
- view.setPageZoom(4.);
1380
- controller.removeAllUserScripts();
1381
- let bg_color = objc2_app_kit::NSColor::colorWithDeviceRed_green_blue_alpha(0.5, 0.2, 0.4, 1.);
1382
- window.setBackgroundColor(Some(&bg_color));
1383
- }
1378
+ view.setPageZoom(4.);
1379
+ controller.removeAllUserScripts();
1380
+ let bg_color = objc2_app_kit::NSColor::colorWithDeviceRed_green_blue_alpha(0.5, 0.2, 0.4, 1.);
1381
+ window.setBackgroundColor(Some(&bg_color));
1382
+ }
1384
1383
1385
- #[cfg(target_os = "android")]
1386
- {
1387
- use jni::objects::JValue;
1388
- webview.jni_handle().exec(|env, _, webview| {
1389
- env.call_method(webview, "zoomBy", "(F)V", &[JValue::Float(4.)]).unwrap();
1390
- })
1391
- }
1392
- });
1393
- Ok(())
1394
- });
1395
- }
1384
+ #[cfg(target_os = "android")]
1385
+ {
1386
+ use jni::objects::JValue;
1387
+ webview.jni_handle().exec(|env, _, webview| {
1388
+ env.call_method(webview, "zoomBy", "(F)V", &[JValue::Float(4.)]).unwrap();
1389
+ })
1390
+ }
1391
+ });
1392
+ Ok(())
1393
+ });
1396
1394
```
1397
1395
"####
1398
1396
) ]
0 commit comments