We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I have a use case where I'd like to be able to detect if the mouse intersects with a tauri window.
The reason is that I use set_ignore_cursor_events(true) to create an overlay displaying something useful to a user.
set_ignore_cursor_events(true)
However, I'd like to be able to allow the user to move their mouse over the window and control the opacity so they can see what behind the window.
Here is an MVP repo that shows you can use javascript to do this but only if the window is in focus.
https://github.com/Hacksore/mouse-intersection-when-ignore-mouse-events
A way in rust to listen globally for the mouse intersecting events of windows.
These events would let you run some "callback" rust code (unsure if that's rusty) but for my use case I'd want to toggle some body class on the app.
tl;dr set_ignore_cursor_events(true), you mouse over a tauri window you can run rust code on enter/exit.
No response
As mentioned initially you can do this in JS but it requires the window to be focused.
Demo:
The text was updated successfully, but these errors were encountered:
I think this could be solved by polling the current cursor position and do the intersection calculation on your end.
Sorry, something went wrong.
feat: add cursor_position getter
cursor_position
5560515
closes #9250
feat: add cursor_position getter (#9297)
477bb8c
* feat: add `cursor_position` getter closes #9250 * js api * Update mod.rs * fix build on iOS and android * use existing wrapper * fmt * adjust wording * update docs --------- Co-authored-by: Lucas Nogueira <lucas@tauri.app>
Successfully merging a pull request may close this issue.
Describe the problem
I have a use case where I'd like to be able to detect if the mouse intersects with a tauri window.
The reason is that I use
set_ignore_cursor_events(true)
to create an overlay displaying something useful to a user.However, I'd like to be able to allow the user to move their mouse over the window and control the opacity so they can see what behind the window.
Here is an MVP repo that shows you can use javascript to do this but only if the window is in focus.
https://github.com/Hacksore/mouse-intersection-when-ignore-mouse-events
Describe the solution you'd like
A way in rust to listen globally for the mouse intersecting events of windows.
These events would let you run some "callback" rust code (unsure if that's rusty) but for my use case I'd want to toggle some body class on the app.
tl;dr
set_ignore_cursor_events(true)
, you mouse over a tauri window you can run rust code on enter/exit.Alternatives considered
No response
Additional context
As mentioned initially you can do this in JS but it requires the window to be focused.
Demo:
2024-03-22_09-58-31.mp4
The text was updated successfully, but these errors were encountered: