FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    CanvasViewport

    struct · ferroui-designer · v0.5.0

    struct CanvasViewport
    

    Maps authored artboard coordinates to a clipped native canvas without remeasuring application content: viewport = artboard * zoom + offset.

    View source

    Members

    MIN_ZOOM

    const MIN_ZOOM: f64
    

    Source

    MAX_ZOOM

    const MAX_ZOOM: f64
    

    Source

    new

    fn new(zoom: f64, offset: Vector) -> Result<Self, String>
    

    Source

    zoom

    fn zoom(self: Self) -> f64
    

    Source

    offset

    fn offset(self: Self) -> Vector
    

    Source

    transform

    fn transform(self: Self) -> Matrix
    

    Source

    artboard_to_viewport

    fn artboard_to_viewport(self: Self, point: Point) -> Point
    

    Source

    viewport_to_artboard

    fn viewport_to_artboard(self: Self, point: Point) -> Point
    

    Source

    zoom_at

    fn zoom_at(self: Self, zoom: f64, anchor: Point) -> Result<Self, String>
    

    Keep the authored point under anchor stationary, including when a limit is reached.

    Source

    pan

    fn pan(self: Self, delta: Vector) -> Result<Self, String>
    

    Translation is in logical viewport pixels, independently of the current zoom.

    Source

    fit

    fn fit(bounds: Rect, viewport: Size, padding: Thickness) -> Result<Self, String>
    

    Center the bounds using the largest supported zoom that fits inside the padding.

    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
    • Same
    • TreeModel
    • Clone
    • Copy
    • Debug
    • StructuralPartialEq
    • PartialEq
    • Default

    Availability

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