Interact with non-Rect shapes (#2199)

* added Ui::interact_with_hovered

* fixed typo
This commit is contained in:
Mason Feurer 2022-10-30 14:59:19 -05:00 committed by GitHub
parent 2b1341095d
commit d97282cd92
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -618,6 +618,22 @@ impl Ui {
)
}
/// Check for clicks, and drags on a specific region that is hovered.
/// This can be used once you have checked that some shape you are painting has been hovered,
/// and want to check for clicks and drags on hovered items this frame.
/// The given [`Rect`] should approximately be where the thing is,
/// as it is just where warnings will be painted if there is an [`Id`] clash.
pub fn interact_with_hovered(
&self,
rect: Rect,
hovered: bool,
id: Id,
sense: Sense,
) -> Response {
self.ctx()
.interact_with_hovered(self.layer_id(), id, rect, sense, self.enabled, hovered)
}
/// Is the pointer (mouse/touch) above this rectangle in this [`Ui`]?
///
/// The `clip_rect` and layer of this [`Ui`] will be respected, so, for instance,