Skip to content

struct

Anchor

pub struct Anchor {
    pub fraction: f64,
    pub pixels: f64,
}

A point on the trigger element or viewport: a fraction of its height plus pixels ("top" = 0, "center" = 0.5, "bottom" = 1, "80%", "100px", "center+=40").

Fields

fraction

pub fraction: f64

How far down, as a fraction of the height.

pixels

pub pixels: f64

Pixels added to that.

Methods

parse

pub fn parse(s: &str) -> Option<Anchor>

Read an anchor: top, center, bottom, a percentage (80%), pixels (100px), optionally with an offset (center+=40).

Trait implementations