Track regions instead of clicks.
Get rid of superfluous params in RenderParams related to hover & click state. Co-authored-by: Antonio <antonio@zed.dev>
This commit is contained in:
parent
cc88bff1ff
commit
85add260f6
2 changed files with 34 additions and 29 deletions
|
@ -3304,11 +3304,15 @@ impl<'a, 'b, V: View> ViewContext<'a, 'b, V> {
|
|||
let region_id = MouseRegionId::new::<Tag>(self.view_id, region_id);
|
||||
MouseState {
|
||||
hovered: self.window.hovered_region_ids.contains(®ion_id),
|
||||
clicked: self
|
||||
.window
|
||||
.clicked_region_ids
|
||||
.get(®ion_id)
|
||||
.and_then(|_| self.window.clicked_button),
|
||||
clicked: if let Some((clicked_region_id, button)) = self.window.clicked_region {
|
||||
if region_id == clicked_region_id {
|
||||
Some(button)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
} else {
|
||||
None
|
||||
},
|
||||
accessed_hovered: false,
|
||||
accessed_clicked: false,
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue