ribir_core 0.2.0-alpha.4

Ribir is a framework for building modern native/wasm cross-platform user interface applications.
Documentation
use crate::prelude::*;

#[derive(PartialEq, Clone, Declare)]
pub struct MouseHover {
  #[declare(skip, default)]
  hover: bool,
}

impl MouseHover {
  pub fn mouse_hover(&self) -> bool { self.hover }
}

impl ComposeChild for MouseHover {
  type Child = Widget;
  fn compose_child(this: impl StateWriter<Value = Self>, child: Self::Child) -> impl WidgetBuilder {
    fn_widget! {
      @ $child {
        on_pointer_enter: move |_| $this.write().hover = true,
        on_pointer_leave: move |_| $this.write().hover = false,
      }
    }
  }
}