[−][src]Struct druid::widget::Viewport
Represents the size and position of a rectangular "viewport" into a larger area.
Fields
content_size: Size
The size of the area that we have a viewport into.
rect: Rect
The view rectangle.
Implementations
impl Viewport
[src]
pub fn clamp_view_origin(&self, origin: Point) -> Point
[src]
Tries to find a position for the view rectangle that is contained in the content rectangle.
If the supplied origin is good, returns it; if it isn't, we try to return the nearest
origin that would make the view rectangle contained in the content rectangle. (This will
fail if the content is smaller than the view, and we return 0.0
in each dimension where
the content is smaller.)
pub fn pan_by(&mut self, delta: Vec2) -> bool
[src]
Changes the viewport offset by delta
, while trying to keep the view rectangle inside the
content rectangle.
Returns true if the offset actually changed. Even if delta
is non-zero, the offset might
not change. For example, if you try to move the viewport down but it is already at the
bottom of the child widget, then the offset will not change and this function will return
false.
pub fn pan_to(&mut self, origin: Point) -> bool
[src]
Sets the viewport origin to pos
, while trying to keep the view rectangle inside the
content rectangle.
Returns true if the position changed. Note that the valid values for the viewport origin
are constrained by the size of the child, and so the origin might not get set to exactly
pos
.
pub fn pan_to_visible(&mut self, rect: Rect) -> bool
[src]
Pan the smallest distance that makes the target Rect
visible.
If the target rect is larger than viewport size, we will prioritize the region of the target closest to its origin.
Trait Implementations
impl Clone for Viewport
[src]
impl Copy for Viewport
[src]
impl Debug for Viewport
[src]
impl Default for Viewport
[src]
impl PartialEq<Viewport> for Viewport
[src]
impl StructuralPartialEq for Viewport
[src]
Auto Trait Implementations
impl RefUnwindSafe for Viewport
[src]
impl Send for Viewport
[src]
impl Sync for Viewport
[src]
impl Unpin for Viewport
[src]
impl UnwindSafe for Viewport
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> AnyEq for T where
T: PartialEq<T> + Any,
[src]
T: PartialEq<T> + Any,
pub fn equals(&self, other: &(dyn Any + 'static)) -> bool
[src]
pub fn as_any(&self) -> &(dyn Any + 'static)
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> RoundFrom<T> for T
pub fn round_from(x: T) -> T
impl<T, U> RoundInto<U> for T where
U: RoundFrom<T>,
U: RoundFrom<T>,
pub fn round_into(self) -> U
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,