Switch MouseEventHandler to use MouseRegions
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
This commit is contained in:
parent
50edcb06dd
commit
893f15ddab
26 changed files with 150 additions and 195 deletions
|
@ -50,11 +50,12 @@ pub struct MouseRegion {
|
|||
pub region_id: usize,
|
||||
pub bounds: RectF,
|
||||
pub hover: Option<Rc<dyn Fn(bool, &mut EventContext)>>,
|
||||
pub mouse_down: Option<Rc<dyn Fn(Vector2F, &mut EventContext)>>,
|
||||
pub click: Option<Rc<dyn Fn(Vector2F, usize, &mut EventContext)>>,
|
||||
pub drag: Option<Rc<dyn Fn(Vector2F, &mut EventContext)>>,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Eq, PartialEq)]
|
||||
#[derive(Copy, Clone, Eq, PartialEq, Hash)]
|
||||
pub struct MouseRegionId {
|
||||
pub view_id: usize,
|
||||
pub tag: TypeId,
|
||||
|
@ -242,6 +243,10 @@ impl Scene {
|
|||
self.active_layer().push_cursor_region(region);
|
||||
}
|
||||
|
||||
pub fn push_mouse_region(&mut self, region: MouseRegion) {
|
||||
self.active_layer().push_mouse_region(region);
|
||||
}
|
||||
|
||||
pub fn push_image(&mut self, image: Image) {
|
||||
self.active_layer().push_image(image)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue