Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

On web the first frame of a multitouch interact_pointer_pos exists, but multitouch doesn't #5550

Open
Devon7925 opened this issue Dec 30, 2024 · 0 comments
Labels
bug Something is broken

Comments

@Devon7925
Copy link

Describe the bug
Multitouch events are not reported as multitouch for the first frame on web. In my app single finger dragging draws, but using multitouch pans. When I'm mid draw and put a second finger down this leads to a line being drawn between the two fingers before it starts panning. This does not happen on windows but happens on both my phone and computer's web browsers.

To Reproduce
Steps to reproduce the behavior:

  1. Print interact_pointer_pos iff ctx.multi_touch() is None
  2. Touch with two fingers and notice the second finger's location is reported despite it being a multitouch

Expected behavior
ctx.multi_touch() should be available the first frame of a multitouch

Desktop (please complete the following information):

  • OS: Windows 11 / Android
  • Browser: Edge / Chrome

Code sample
This is a trimmed down version of the code I'm using.

let mut did_drag = false;
if let Some(multi_touch) = response.ctx.multi_touch() {
    did_drag = true;
}
if let Some(pointer_pos) = response.interact_pointer_pos() {
    if (response.drag_started_by(egui::PointerButton::Primary)
        || response.dragged_by(egui::PointerButton::Primary))
        && !did_drag
    {
        // do drawing
    }
}
        
@Devon7925 Devon7925 added the bug Something is broken label Dec 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is broken
Projects
None yet
Development

No branches or pull requests

1 participant