You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It has a problem, which is that it swallows right clicks. So if I or a user want to look at the Chrome Inspector, they can't just right click the way they're used to.
I find the documentation explains that winit by default calls preventDefault() on every event; and if I add window.set_prevent_default(false); to line 979, right after initializing the window, then as documented winit will not do this, pass on the events, and right click works.
But, I do not want all events preventDefaulted! For example I don't want the scrollwheel to trigger, and I plan to add special behaviors for click-and-drag. There doesn't currently seem to be a way to request preventDefault for some events but not all.
So, here is my feature request: add to either Event<T> or ActiveEventLoop a function named like prevent_default_current(p: bool) which, if calls, overrides the set_prevent_default for the current event. That way I could default to preventing default, but prevent_default_current(false) on right-clicks specifically, and that way get the behavior I want in all cases with little hassle.
Relevant platforms
Web
The text was updated successfully, but these errors were encountered:
This is a duplicate of #2831.
While we concluded there that it might not be needed to do fine-grained filtering because the only relevant use case is the clipboard, allowing the developer console specifically is a use case that might change this outlook.
Note that you can use WindowAttributes::with_prevent_default() to do this before creating the window.
Description
I have a web app: https://data.runhello.com/j/wgpu/special/winit-swallow/
That URL is https://github.com/mcclure/webgpu-tutorial-rs/ commit a8fa378.
It is built with Rust + Trunk + winit + webgpu (so it will only work on Chrome or possibly Firefox Nightly).
It has a problem, which is that it swallows right clicks. So if I or a user want to look at the Chrome Inspector, they can't just right click the way they're used to.
I find the documentation explains that winit by default calls
preventDefault()
on every event; and if I addwindow.set_prevent_default(false);
to line 979, right after initializing the window, then as documented winit will not do this, pass on the events, and right click works.But, I do not want all events preventDefaulted! For example I don't want the scrollwheel to trigger, and I plan to add special behaviors for click-and-drag. There doesn't currently seem to be a way to request preventDefault for some events but not all.
So, here is my feature request: add to either
Event<T>
orActiveEventLoop
a function named likeprevent_default_current(p: bool)
which, if calls, overrides theset_prevent_default
for the current event. That way I could default to preventing default, butprevent_default_current(false)
on right-clicks specifically, and that way get the behavior I want in all cases with little hassle.Relevant platforms
Web
The text was updated successfully, but these errors were encountered: