FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    MapViewport

    struct · ferroui-livecharts · v0.5.0

    struct MapViewport
    

    The pan and zoom of a map (MapViewportTransform, GeoMapChart.ZoomLevel and PanOffset): a projected position p is drawn at p * zoom + center * (1 - zoom) + pan, where center is the centre of the control. The stroke of the lands scales with the zoom, as the source's canvas matrix scales it.

    View source

    Members

    zoom

    zoom: f64
    

    Source

    pan

    pan: ferroui_base::Point
    

    Source

    new

    fn new(zoom: f64, pan: Point) -> Self
    

    Source

    is_identity

    fn is_identity(self: &Self) -> bool
    

    Whether the viewport changes nothing (the opposite of IsActive).

    Source

    transform

    fn transform(self: &Self, point: Point, center: Point) -> Point
    

    The screen position of a projected position.

    Source

    inverse

    fn inverse(self: &Self, point: Point, center: Point) -> Point
    

    The projected position of a screen position (InverseViewportTransform); a zoom of 0 is taken as 1.

    Source

    panned

    fn panned(self: &Self, delta: Point) -> Self
    

    The viewport moved by a screen distance (MapFactory.Pan).

    Source

    zoomed

    fn zoomed(self: &Self, pivot: Point, direction: ZoomDirection, speed: f64, min_zoom: f64, max_zoom: f64, center: Point) -> Self
    

    One zoom step about a screen position, which stays in place (MapFactory.Zoom). The speed is clamped to [0.1, 0.95]; a step in multiplies the zoom by 1 / (1 - speed), a step out by 1 - speed. The zoom stays at most max_zoom and at least 0.8 * min_zoom, the overshoot that the bounce back of a release takes back.

    Source

    bounce_back_target

    fn bounce_back_target(self: &Self, control: Size, min_zoom: f64) -> Option<Self>
    

    Where a release settles the viewport (BounceBack): the zoom back to at least min_zoom and the map, the size of the control at that zoom, panned to cover the control. None when the viewport is already there.

    Source

    interpolate

    fn interpolate(self: &Self, to: &Self, t: f64) -> Self
    

    The viewport t of the way from this one to to.

    Source

    Trait implementations

    • Send
    • Sync
    • Freeze
    • UnsafeUnpin
    • Unpin
    • UnwindSafe
    • RefUnwindSafe
    • Borrow<T>
    • BorrowMut<T>
    • CloneToUninit
    • Into<U>
    • From<T>
    • TryInto<U>
    • TryFrom<U>
    • Any
    • ToOwned
    • PropertyValue
    • AnyValue
    • ClassDefaults
    • ErasedDestructor
    • IntoEither
    • Clone
    • Copy
    • Debug
    • StructuralPartialEq
    • PartialEq
    • Default

    Availability

    Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.