Function dispatch_event_envelope_bubbling

Source
pub fn dispatch_event_envelope_bubbling<A: 'static>(
    tree: &ElementTree<A>,
    runtime: RuntimeHandle<A>,
    target: ElementId,
    envelope: &EventEnvelope,
)
Expand description

Bubbles an envelope while preserving its host correlation metadata.

The target is visited before ancestors and propagation stops when a widget calls EventCtx::stop_propagation. Metadata is reference-counted across callbacks; the input envelope itself remains borrowed.

ยงExamples

use std::time::Duration;
use ailloli_ui_core::event::{Event, FocusEvent};
use ailloli_ui_runtime::{app::{PresentationGeneration, RuntimeHandle}, element::{ElementKind, ElementTree}, input::{dispatch_event_envelope_bubbling, EventEnvelope, EventId, EventMeta, EventTimestamp}};
let mut tree = ElementTree::<()>::new();
let target = tree.create_element(ElementKind::Empty, None, None);
let envelope = EventEnvelope::new(
    EventMeta::new(EventId::new(3), EventTimestamp::new(Duration::ZERO), "main", PresentationGeneration::INITIAL),
    Event::Focus(FocusEvent::new(true)),
);
dispatch_event_envelope_bubbling(&tree, RuntimeHandle::new(), target, &envelope);