Skip to main content

shield

Function shield 

Source
pub fn shield<State: 'static, V: View<State>>(child: V) -> ShieldView<State>
Expand description

Mark child as frust content that must keep receiving pointer input even where it paints over an interactive platform-view slot (the z-shield — see the module docs).

Layout/paint/event/semantics transparent: the child is laid out under the wrapper’s own constraints at its own size, painted unchanged, and routed events unchanged. The only added behavior is one PaintCtx::report_input_shield call per paint, carrying the rect the wrapper just painted into.

Wrap the narrowest chrome that actually needs input — a shield is a hole in the native view’s input region, so an over-wide one silently takes touches away from it.

ⓘ
any(Stack(vec![
    any(platform_view("dev.frust.MapFactory").interactive()),
    any(shield(button("recenter", |s: &mut State| s.recenter()))),
]))