Button clicked on mouse release

This commit is contained in:
Emil Ernerfeldt 2019-03-16 12:56:00 +01:00
parent e1652bef77
commit 075fa7ab0f

View file

@ -303,6 +303,10 @@ impl Region {
self.available_space.x self.available_space.x
} }
pub fn height(&self) -> f32 {
self.available_space.y
}
pub fn direction(&self) -> Direction { pub fn direction(&self) -> Direction {
self.dir self.dir
} }
@ -543,9 +547,8 @@ impl Region {
} else { } else {
false false
}; };
let clicked = hovered && self.input().mouse_clicked;
let active = if interaction_id.is_some() { let active = if interaction_id.is_some() {
if clicked { if hovered && self.input().mouse_clicked {
memory.active_id = interaction_id; memory.active_id = interaction_id;
} }
memory.active_id == interaction_id memory.active_id == interaction_id
@ -553,6 +556,7 @@ impl Region {
false false
}; };
let clicked = hovered && self.input().mouse_released;
InteractInfo { InteractInfo {
rect, rect,
hovered, hovered,