-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Web demo loses mouse cursor position when dragging off the window #3157
Comments
I tried registering |
Sorry, I said the wrong thing. It should be on document.addEventListener("mousemove", e => console.log(e.clientX, e.clientY)); |
Nice, that works! I just have to figure out what to do with |
* Closes #3157 If the mouse leaves the canvas when dragging a slider, the slider will still move. --- To support this, I had to revert #4419 Despite that, I fail to reproduce the two issues it claimed to solve: * #4406 may have been solved in another way by this PR * #4418 I cannot reproduce on Mac. If it is still a problem, I think it should be solved by triggering a `PointerEvent::Released` when focus is lost (i.e. on alt-tab), and not on `PointerGone`
* Closes emilk#3157 If the mouse leaves the canvas when dragging a slider, the slider will still move. --- To support this, I had to revert emilk#4419 Despite that, I fail to reproduce the two issues it claimed to solve: * emilk#4406 may have been solved in another way by this PR * emilk#4418 I cannot reproduce on Mac. If it is still a problem, I think it should be solved by triggering a `PointerEvent::Released` when focus is lost (i.e. on alt-tab), and not on `PointerGone`
Describe the bug
While dragging in the web demo if the mouse goes off the window egui stops receiving mouse events
To Reproduce
Steps to reproduce the behavior:
Expected behavior
The triangle should keep dragging even with the mouse off the window
Screenshots
firefox_qLVcHJKFpk.mp4
The triangle stops rotating when the mouse goes off the screen, even though the mouse is held down
Desktop (please complete the following information):
All
Smartphone (please complete the following information):
All
Additional context
Event listeners registered on document.body will continue to give mousemove/touchmove events even with the cursor off the screen, but eframe only registers event listeners on the canvas element.
egui/crates/eframe/src/web/events.rs
Lines 256 to 315 in 083d61f
This registers event listeners on the canvas element, but after mousedown/touchdown, event listeners need to be registered on the document element in order to continue receiving mousemove events as the mouse goes off the screen.
The text was updated successfully, but these errors were encountered: