Skip to main content

sticky_offset

Function sticky_offset 

Source
pub fn sticky_offset(
    edges: &EdgeOption,
    box_rect: &Rect,
    viewport: StickyViewport,
    containing: (f32, f32),
) -> (f32, f32)
Expand description

Compute the sticky translate for a box relative to its nearest scrollport.

box_rect is the sticky box’s border box (its natural position, in parent-content space) and containing is the parent content-box size — the containing block the box may not leave. Per CSS-POSITION-3 §3.4 the box is shifted inward just enough to keep each specified edge inside the scrollport’s “sticky view rectangle” (the visible region, whose top-left is viewport.top_left), while staying within the containing block.