pub struct Viewport {
pub translation: Point,
pub scale: f64,
}Expand description
Per-view viewport, excluded from document serialization and history.
Fields§
§translation: PointTranslation in screen CSS pixels.
scale: f64Positive magnification (bounded to 0.1–4).
Implementations§
Source§impl Viewport
impl Viewport
Sourcepub fn to_canvas(self, point: Point) -> Result<Point, MindMapError>
pub fn to_canvas(self, point: Point) -> Result<Point, MindMapError>
Convert view-local screen coordinates into unscaled canvas coordinates.
Sourcepub fn zoom_at(&mut self, scale: f64, anchor: Point) -> Result<(), MindMapError>
pub fn zoom_at(&mut self, scale: f64, anchor: Point) -> Result<(), MindMapError>
Zoom around a view-local anchor, preserving its canvas point.
Sourcepub fn pan(&mut self, delta: Point) -> Result<(), MindMapError>
pub fn pan(&mut self, delta: Point) -> Result<(), MindMapError>
Translate by a finite screen-space delta.
Sourcepub fn center(&mut self, target: Point, size: Point) -> Result<(), MindMapError>
pub fn center(&mut self, target: Point, size: Point) -> Result<(), MindMapError>
Center a canvas-space point in the specified view dimensions.
Sourcepub fn validate(self) -> Result<(), MindMapError>
pub fn validate(self) -> Result<(), MindMapError>
Check public fields before applying a transform.
Trait Implementations§
impl Copy for Viewport
impl StructuralPartialEq for Viewport
Auto Trait Implementations§
impl Forget for Viewport
impl Freeze for Viewport
impl Move for Viewport
impl RefUnwindSafe for Viewport
impl Send for Viewport
impl Sync for Viewport
impl Unpin for Viewport
impl UnsafeUnpin for Viewport
impl UnwindSafe for Viewport
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DependencyElement for T
Source§impl<T> InitializeFromFunction<T> for T
impl<T> InitializeFromFunction<T> for T
Source§fn initialize_from_function(f: fn() -> T) -> T
fn initialize_from_function(f: fn() -> T) -> T
Create an instance of this type from an initialization function
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<Ret> SpawnIfAsync<(), Ret> for Ret
impl<Ret> SpawnIfAsync<(), Ret> for Ret
Source§impl<T, O> SuperFrom<T> for Owhere
O: From<T>,
impl<T, O> SuperFrom<T> for Owhere
O: From<T>,
Source§fn super_from(input: T) -> O
fn super_from(input: T) -> O
Convert from a type to another type.
Source§impl<T, O, M> SuperInto<O, M> for Twhere
O: SuperFrom<T, M>,
impl<T, O, M> SuperInto<O, M> for Twhere
O: SuperFrom<T, M>,
Source§fn super_into(self) -> O
fn super_into(self) -> O
Convert from a type to another type.