Skip to content

Commit

Permalink
[libgui - UEFI] Provide an implementation for mouse-released
Browse files Browse the repository at this point in the history
  • Loading branch information
codyd51 committed Apr 5, 2024
1 parent 0d41965 commit 6f6cdf9
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions rust_programs/libgui/src/window_uefi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,13 @@ impl AwmWindow {
}

pub fn handle_mouse_left_click_down(&self, mouse_pos: Point) {
let elems = &*self.ui_elements.borrow();
for elem in elems {
let mouse_point = Point::from(mouse_pos);
let elem_pos = mouse_point - elem.frame().origin;
elem.handle_left_click(elem_pos);
}
/*
let mut clicked_elem = None;
{
let elems = &*self.ui_elements.borrow();
Expand All @@ -132,12 +139,19 @@ impl AwmWindow {
// Translate the mouse position to the element's coordinate system
let mouse_point = Point::from(mouse_pos);
let elem_pos = mouse_point - c.frame().origin;
c.handle_left_click(elem_pos);
}
*/
}

pub fn handle_mouse_left_click_up(&self, mouse_pos: Point) {
// Nothing to do
pub fn handle_mouse_left_click_up(&self, mouse_point: Point) {
// Note that we send this event to all elements, regardless of whether they bound the mouse
// when it's released. This helps to implement drag states where the element stays dragged
// even if the mouse leaves the element's frame.
for elem in self.ui_elements.borrow().iter() {
// Translate the mouse position to the element's coordinate system
let elem_pos = mouse_point - elem.frame().origin;
elem.handle_left_click_up(elem_pos);
}
}
}

Expand Down

0 comments on commit 6f6cdf9

Please sign in to comment.