ribir_core/builtin_widgets/
ignore_pointer.rs

1use crate::prelude::*;
2
3#[derive(Declare, SingleChild, Query, Clone)]
4pub struct IgnorePointer {
5  #[declare(default = true)]
6  pub ignore: bool,
7}
8
9impl Render for IgnorePointer {
10  #[inline]
11  fn perform_layout(&self, clamp: BoxClamp, ctx: &mut LayoutCtx) -> Size {
12    ctx.assert_perform_single_child_layout(clamp)
13  }
14
15  #[inline]
16  fn paint(&self, _: &mut PaintingCtx) {}
17
18  fn hit_test(&self, _: &HitTestCtx, _: Point) -> HitTest {
19    HitTest { hit: false, can_hit_child: !self.ignore }
20  }
21}
22
23impl IgnorePointer {
24  #[inline]
25  pub fn new(ignore: bool) -> Self { Self { ignore } }
26}