1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-31 05:40:03 -04:00

Refactor integrations (#871)

* Unify code in egui_glium and egui_glow into egui_winit::EpiIntegration
* Simplify `EguiGlium` interface
* Simplify `EguiGlow` interface
* egui_web refactor: merge `WebBackend` into `AppRunner`
This commit is contained in:
Emil Ernerfeldt
2021-11-03 13:45:51 +01:00
committed by GitHub
parent b1716be745
commit 1dbe608e73
14 changed files with 381 additions and 479 deletions

View File

@@ -293,38 +293,6 @@ impl epi::Storage for LocalStorage {
// ----------------------------------------------------------------------------
pub fn handle_output(output: &egui::Output, runner: &mut AppRunner) {
let egui::Output {
cursor_icon,
open_url,
copied_text,
needs_repaint: _, // handled elsewhere
events: _, // we ignore these (TODO: accessibility screen reader)
mutable_text_under_cursor,
text_cursor_pos,
} = output;
set_cursor_icon(*cursor_icon);
if let Some(open) = open_url {
crate::open_url(&open.url, open.new_tab);
}
#[cfg(web_sys_unstable_apis)]
if !copied_text.is_empty() {
set_clipboard_text(copied_text);
}
#[cfg(not(web_sys_unstable_apis))]
let _ = copied_text;
runner.mutable_text_under_cursor = *mutable_text_under_cursor;
if &runner.text_cursor_pos != text_cursor_pos {
move_text_cursor(text_cursor_pos, runner.canvas_id());
runner.text_cursor_pos = *text_cursor_pos;
}
}
pub fn set_cursor_icon(cursor: egui::CursorIcon) -> Option<()> {
let document = web_sys::window()?.document()?;
document