diff --git a/Cargo.toml b/Cargo.toml index 1139cb007..16341302c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -45,7 +45,7 @@ bevy = { version = "0.10", default-features = false, features = [ [target.'cfg(target_arch = "wasm32")'.dependencies] winit = "0.28" -web-sys = { version = "*", features = [ +web-sys = { version = "0.3.63", features = [ "Clipboard", "ClipboardEvent", "DataTransfer", diff --git a/src/lib.rs b/src/lib.rs index 1eb5f77a6..ef7a9bcb8 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -144,10 +144,6 @@ impl Default for EguiSettings { #[derive(Component, Clone, Debug, Default, Deref, DerefMut)] pub struct EguiInput(pub egui::RawInput); -/// A resource to check if we're on a mac, correctly detects on web too. -#[derive(Resource)] -pub struct IsMac(pub bool); - /// A resource for accessing clipboard. /// /// The resource is available only if `manage_clipboard` feature is enabled. @@ -557,21 +553,6 @@ impl Plugin for EguiPlugin { world.init_resource::(); world.init_resource::(); world.init_resource::(); - if !world.contains_resource::() { - let mut is_mac = cfg!(target_os = "macos"); - #[cfg(target_arch = "wasm32")] - { - let window = web_sys::window().expect("window"); - - let nav = window.navigator(); - let platform = nav.platform(); - if let Ok(platform) = platform { - is_mac = platform.starts_with("Mac"); - } - } - log::info!(is_mac); - world.insert_resource(IsMac(is_mac)); - } #[cfg(all(feature = "manage_clipboard", target_arch = "wasm32"))] app.add_startup_system(web_clipboard::startup_setup_web_events); diff --git a/src/systems.rs b/src/systems.rs index 7b5def730..c3aa20314 100644 --- a/src/systems.rs +++ b/src/systems.rs @@ -1,5 +1,5 @@ use crate::{ - EguiContext, EguiContextQuery, EguiInput, EguiMousePosition, EguiSettings, IsMac, WindowSize, + EguiContext, EguiContextQuery, EguiInput, EguiMousePosition, EguiSettings, WindowSize, }; #[cfg(feature = "open_url")] use bevy::log; @@ -71,14 +71,33 @@ pub struct ContextSystemParams<'w, 's> { /// Processes Bevy input and feeds it to Egui. pub fn process_input_system( - mut is_mac: Res, mut input_events: InputEvents, mut input_resources: InputResources, mut context_params: ContextSystemParams, egui_settings: Res, mut egui_mouse_position: ResMut, time: Res