makepad_platform/event/
designer.rs1use {
2 crate::{
3 DVec2,
4 event::Event,
5 cx::Cx,
6 area::Area,
7 Margin,
8 }
9};
10
11#[derive(Clone, Debug)]
12pub struct DesignerPickEvent {
13 pub abs: DVec2,
14}
15
16pub enum HitDesigner{
17 DesignerPick(DesignerPickEvent),
18 Nothing
19}
20
21impl Event{
22 pub fn hit_designer(&self, cx: &mut Cx, area:Area)->HitDesigner{
23 match self{
24 Event::DesignerPick(e) => {
25 let rect = area.clipped_rect(&cx);
26 if Margin::rect_contains_with_margin(e.abs, &rect, &None){
27 return HitDesigner::DesignerPick(e.clone())
28 }
29 }
30 _=>{}
31 }
32 HitDesigner::Nothing
33 }
34}