-
Notifications
You must be signed in to change notification settings - Fork 119
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
Add passthrough code #714
base: main
Are you sure you want to change the base?
Add passthrough code #714
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is_passthrough
mechanism also needs to care about pointer capture.
/// Whether this widgets obstructs pointer events for something behind the window. | ||
/// | ||
/// Somewhat experimental. | ||
fn is_passthrough(&self) -> bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the semantic difference between this and accepts_pointer_interaction
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is_passthrough
doesn't affect children.
There's probably a way to design these features to be more orthogonal and principled, but this is meant to be a quick-and-easy fix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Happy to see this. egui and others have similar and it is definitely something that was on our wishlist that I hadn't gotten around to yet.
@@ -325,6 +326,28 @@ impl RenderRoot { | |||
self.cursor_icon | |||
} | |||
|
|||
pub fn is_passthrough(&self, pos: PhysicalPosition<f64>) -> bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs a doc comment.
@@ -325,6 +326,28 @@ impl RenderRoot { | |||
self.cursor_icon | |||
} | |||
|
|||
pub fn is_passthrough(&self, pos: PhysicalPosition<f64>) -> bool { | |||
let pos = Vec2::new(pos.x, pos.y) / self.scale_factor; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be nice if we were just using dpi::LogicalPosition
here.
@@ -199,6 +199,13 @@ pub trait Widget: AsAny { | |||
false | |||
} | |||
|
|||
/// Whether this widgets obstructs pointer events for something behind the window. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd add a pointer back to the RenderRoot
method and the doc comment that will be there which can contain the more complete explanation.
This code should help people who want to embed Masonry in a video game UI.