Skip to main content

Shown

Trait Shown 

pub trait Shown {
    // Required methods
    fn scroll(&self) -> Vec2;
    fn clip(&self) -> Rect;
    fn transform(&self) -> Affine;
    fn same_view(&self, other: &Self) -> bool;
    fn overlays(&self, out: &mut Vec<Rect>);

    // Provided method
    fn same_content(&self, _other: &Self) -> bool { ... }
}
Expand description

One frame of a scroller, as a later frame compares it.

Required Methods§

fn scroll(&self) -> Vec2

How far the content is scrolled: it lands on screen at its origin minus this, in logical pixels.

fn clip(&self) -> Rect

Where the content paints, in logical pixels.

fn transform(&self) -> Affine

The transform the content landed on screen with (super::on_screen).

fn same_view(&self, other: &Self) -> bool

Whether self shows the content as other does but for the scroll and what the scroller damages in place itself: the same zoom, the same content size, the same look.

fn overlays(&self, out: &mut Vec<Rect>)

What the scroller paints over its content inside Self::clip that does not move with it (a scroll bar’s lane, an edge fade, a banner).

Provided Methods§

fn same_content(&self, _other: &Self) -> bool

Whether the content itself is as other shows it, so a scroll between the two only moves it. A scroller whose content changed in place repaints a scrolled frame.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

§

impl<L, P> Shown for Showing<L, P>
where L: PartialEq, P: PartialEq,