Take Rectangle by value in Cursor API

This commit is contained in:
Héctor Ramón Jiménez 2023-06-08 20:16:46 +02:00
parent 34451bff18
commit 5c8cfb411e
No known key found for this signature in database
GPG key ID: 140CC052C94F138E
21 changed files with 57 additions and 62 deletions

View file

@ -407,7 +407,7 @@ mod grid {
}
let cursor_position =
if let Some(position) = cursor.position_in(&bounds) {
if let Some(position) = cursor.position_in(bounds) {
position
} else {
return (event::Status::Ignored, None);
@ -567,10 +567,9 @@ mod grid {
let overlay = {
let mut frame = Frame::new(renderer, bounds.size());
let hovered_cell =
cursor.position_in(&bounds).map(|position| {
Cell::at(self.project(position, frame.size()))
});
let hovered_cell = cursor.position_in(bounds).map(|position| {
Cell::at(self.project(position, frame.size()))
});
if let Some(cell) = hovered_cell {
frame.with_save(|frame| {
@ -675,7 +674,7 @@ mod grid {
Interaction::Drawing => mouse::Interaction::Crosshair,
Interaction::Erasing => mouse::Interaction::Crosshair,
Interaction::Panning { .. } => mouse::Interaction::Grabbing,
Interaction::None if cursor.is_over(&bounds) => {
Interaction::None if cursor.is_over(bounds) => {
mouse::Interaction::Crosshair
}
_ => mouse::Interaction::default(),