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.
Members
MIN_ZOOMMAX_ZOOMnewzoomoffsettransformartboard_to_viewportviewport_to_artboardzoom_atpanfit
MIN_ZOOM
const MIN_ZOOM: f64
MAX_ZOOM
const MAX_ZOOM: f64
new
fn new(zoom: f64, offset: Vector) -> Result<Self, String>
zoom
fn zoom(self: Self) -> f64
offset
fn offset(self: Self) -> Vector
transform
fn transform(self: Self) -> Matrix
artboard_to_viewport
fn artboard_to_viewport(self: Self, point: Point) -> Point
viewport_to_artboard
fn viewport_to_artboard(self: Self, point: Point) -> Point
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.
pan
fn pan(self: Self, delta: Vector) -> Result<Self, String>
Translation is in logical viewport pixels, independently of the current zoom.
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.
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafeBorrow<T>BorrowMut<T>CloneToUninitInto<U>From<T>TryInto<U>TryFrom<U>AnyToOwnedPropertyValueAnyValueClassDefaultsErasedDestructorIntoEitherSameTreeModelCloneCopyDebugStructuralPartialEqPartialEqDefault
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.