feat: Allow navigating with gestures

Resolved #81
This commit is contained in:
pan93412
2022-11-20 12:26:09 +08:00
parent 79d0724da3
commit 59a3a74d7b

View File

@@ -44,7 +44,7 @@ use wry::{
fn main() -> wry::Result<()> { fn main() -> wry::Result<()> {
#[cfg(target_os = "macos")] #[cfg(target_os = "macos")]
let mut menu_bar_menu = Menu::new(); let mut menu_bar_menu = Menu::new();
#[cfg(target_os = "macos")] #[cfg(target_os = "macos")]
@@ -139,7 +139,7 @@ fn main() -> wry::Result<()> {
let window = common_window let window = common_window
.with_title("") .with_title("")
.build(&event_loop) .build(&event_loop)
.unwrap(); .unwrap();
#[cfg(target_os = "macos")] #[cfg(target_os = "macos")]
let window = common_window let window = common_window
@@ -165,12 +165,13 @@ fn main() -> wry::Result<()> {
webbrowser::open(&href).expect("no browser"); webbrowser::open(&href).expect("no browser");
} }
}; };
let webview = WebViewBuilder::new(window)? let webview = WebViewBuilder::new(window)?
.with_url(&url.to_string())? .with_url(&url.to_string())?
.with_devtools(cfg!(feature = "devtools")) .with_devtools(cfg!(feature = "devtools"))
.with_initialization_script(include_str!("pake.js")) .with_initialization_script(include_str!("pake.js"))
.with_ipc_handler(handler) .with_ipc_handler(handler)
.with_back_forward_navigation_gestures(true)
.build()?; .build()?;