Gesture Detector

The GestureDetector widget allows you to capture widget interactions with its child widget. It can be used to easily create custom widgets or react to user interaction.

GestureDetector::new(Text::new("Gesture Detector".to_string()))
    .with_on_hover(
        EvalSignal::new(move || {
            println!("Hovered");
            Update::DRAW
        })
        .hook(&context)
        .maybe(),
    )
    .with_on_release(
        EvalSignal::new(move || {
            println!("Release");
            Update::DRAW
        })
        .hook(&context)
        .maybe(),
    )
    .with_on_press(
        EvalSignal::new(move || {
            println!("Press");
            Update::DRAW
        })
        .hook(&context)
        .maybe(),
    )

For a full example, see the gesture detector example.