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

Only repaint on cursor movements of area, or if dragging outside (#4730)

* Closes https://github.com/emilk/egui/issues/4723

Also fix some small bugs in the touch input on web
This commit is contained in:
Emil Ernerfeldt
2024-06-28 17:40:48 +02:00
committed by GitHub
parent 10f092d9d4
commit 0c059ac113
7 changed files with 142 additions and 120 deletions

View File

@@ -12,10 +12,7 @@ use super::percent_decode;
#[derive(Default)]
pub(crate) struct WebInput {
/// Required because we don't get a position on touched
pub latest_touch_pos: Option<egui::Pos2>,
/// Required to maintain a stable touch position for multi-touch gestures.
pub latest_touch_pos_id: Option<egui::TouchId>,
pub primary_touch: Option<egui::TouchId>,
/// The raw input to `egui`.
pub raw: egui::RawInput,
@@ -46,8 +43,7 @@ impl WebInput {
self.raw.modifiers = egui::Modifiers::default(); // Avoid sticky modifier keys on alt-tab:
self.raw.focused = focused;
self.raw.events.push(egui::Event::WindowFocused(focused));
self.latest_touch_pos = None;
self.latest_touch_pos_id = None;
self.primary_touch = None;
}
}