Which egui requirement permit virtual keyboard opening on smartphones ? #1309
-
Hello ! First, A big thank you for this amazing lib. Egui is awesome for Rust world. I have an issue with virtual keyboard opening on smartphones when use egui with its macroquad integration. Explainations : Virtual keyboard opening on smartphones works well with egui when I try on my dev machine or online (tested version 0.17 and 0.16): But, It fails to open virtual keyboard opening on smartphones when I use macroquad integration. There is the HowTo reproduction method :
use macroquad::prelude::*;
#[macroquad::main("egui with macroquad")]
async fn main() {
let mut text = "input here 2".to_string();
loop {
clear_background(WHITE);
egui_macroquad::ui(|egui_ctx| {
egui::Window::new("egui ❤ macroquad").show(egui_ctx, |ui| {
ui.text_edit_singleline(&mut text);
});
});
egui_macroquad::draw();
next_frame().await;
}
} To make macroquad builds able to work with wasm-bindgem, we must use this helper script : (
For information, egui macroquad integration code is visible here : https://github.com/optozorax/egui-macroquad/blob/master/src/lib.rs My question : What in egui is permitting virtual keyboard opening ? Which seems to be missing in macroquad egui integration or wasm-bindgem compatibility hack. I would be happy to help make this work. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
egui_web attach dummy input element to body to capture KeyboardEvent,InputEvent,CompositionEvent but macroquad does not add input element . |
Beta Was this translation helpful? Give feedback.
-
The dummy input element initial/enabling/moving logic is in this file, Composition events handle logic is here, hope that helps. |
Beta Was this translation helpful? Give feedback.
-
Yes, that's the calling process, #[wasm_bindgen] is used to expose start(...) to JavaScript. |
Beta Was this translation helpful? Give feedback.
egui_web attach dummy input element to body to capture KeyboardEvent,InputEvent,CompositionEvent but macroquad does not add input element .
this workaround introduced by @n2 in #253 .