Skip to content

Commit

Permalink
fix wasm
Browse files Browse the repository at this point in the history
  • Loading branch information
aevyrie committed Nov 8, 2024
1 parent fc758a8 commit 2b6d898
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -724,7 +724,7 @@ impl Plugin for EguiPlugin {
{
use std::sync::{LazyLock, Mutex};

let maybe_window_plugin = app.get_added_plugins::<bevy::prelude::WindowPlugin>();
let maybe_window_plugin = app.get_added_plugins::<bevy_window::WindowPlugin>();

if !maybe_window_plugin.is_empty()
&& maybe_window_plugin[0].primary_window.is_some()
Expand Down
17 changes: 8 additions & 9 deletions src/text_agent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@
use std::sync::{LazyLock, Mutex};

use bevy::{
prelude::{EventWriter, NonSendMut, Res, Resource},
window::RequestRedraw,
};
use bevy_ecs::prelude::*;
use bevy_window::RequestRedraw;

use crossbeam_channel::{unbounded, Receiver, Sender};

use wasm_bindgen::prelude::*;
Expand Down Expand Up @@ -364,21 +363,21 @@ pub fn update_text_agent(editing_text: bool) {
let window = match web_sys::window() {
Some(window) => window,
None => {
bevy::log::error!("No window found");
bevy_log::error!("No window found");
return;
}
};
let document = match window.document() {
Some(doc) => doc,
None => {
bevy::log::error!("No document found");
bevy_log::error!("No document found");
return;
}
};
let input: HtmlInputElement = match document.get_element_by_id(AGENT_ID) {
Some(ele) => ele,
None => {
bevy::log::error!("Agent element not found");
bevy_log::error!("Agent element not found");
return;
}
}
Expand All @@ -393,13 +392,13 @@ pub fn update_text_agent(editing_text: bool) {
match input.focus().ok() {
Some(_) => {}
None => {
bevy::log::error!("Unable to set focus");
bevy_log::error!("Unable to set focus");
}
}
} else if keyboard_open {
// Close the keyboard.
if input.blur().is_err() {
bevy::log::error!("Agent element not found");
bevy_log::error!("Agent element not found");
return;
}

Expand Down

0 comments on commit 2b6d898

Please sign in to comment.