emilk / egui

egui: an easy-to-use immediate mode GUI in Rust that runs on both web and native
https://www.egui.rs/
Apache License 2.0
20.61k stars 1.49k forks source link

Trouchscreen pointer doesn't release #4668

Open Saecki opened 1 week ago

Saecki commented 1 week ago

Describe the bug The touch screen pointer does never release, so input.interact_pos() always stays Some(...).

To Reproduce Steps to reproduce the behavior:

I can reproduce the behavior described above with the following egui app:

Cargo.toml

[package]
name = "egui_touchscreen_repro"
version = "0.1.0"
edition = "2021"

[dependencies]
egui = { git = "https://github.com/emilk/egui", branch = "master" }
eframe = { git = "https://github.com/emilk/egui", branch = "master" }

main.rs

use eframe::NativeOptions;
use egui::CentralPanel;

fn main() {
    eframe::run_native(
        "touch_screen_test",
        NativeOptions::default(),
        Box::new(|_cc| Ok(Box::new(TouchScreenApp))),
    )
    .expect("error running app");
}

struct TouchScreenApp;

impl eframe::App for TouchScreenApp {
    fn update(&mut self, ctx: &egui::Context, _frame: &mut eframe::Frame) {
        CentralPanel::default().show(ctx, |ui| {
            let pos = ui.input(|i| i.pointer.interact_pos());
            let text = format!("{pos:?}");
            ui.label(text);
        });
    }
}

Screenshots image

Expected behavior The pointer should be released after the finger leaves the screen.

Desktop (please complete the following information):

Saecki commented 1 week ago

After some more investigation I found this still works with egui 0.24 but breaks with 0.25.