pub struct Viewport<'a> { /* private fields */ }Expand description
The viewport widget, built per frame.
Need (image): an image viewport (pan, zoom, tiles).
Implementations§
Source§impl<'a> Viewport<'a>
impl<'a> Viewport<'a>
Sourcepub fn new(id_salt: impl AsIdSalt) -> Viewport<'a>
pub fn new(id_salt: impl AsIdSalt) -> Viewport<'a>
A viewport; id_salt tells it apart from others in the same Ui
and names it in the debug bridge.
Sourcepub fn hint(self, on: bool) -> Viewport<'a>
pub fn hint(self, on: bool) -> Viewport<'a>
Shows the navigation model’s one-time hint on the first hover
(navigation::hint, kind image; default: off).
Sourcepub fn on_cursor(
self,
hook: impl FnMut(&CursorQuery, Cursor) -> Cursor + 'a,
) -> Viewport<'a>
pub fn on_cursor( self, hook: impl FnMut(&CursorQuery, Cursor) -> Cursor + 'a, ) -> Viewport<'a>
Decides the cursor: gets the situation (the tool, the keys held, a
drag, a handle under the pointer) and egui-pop’s default for it,
returns the cursor to show. Asked again only when the situation
changes (or after ViewportState::refresh_cursor);
egui-pop-imaging’s cursor runs it as the cursor.resolve
step.
Sourcepub fn tool(self, tool: Tool) -> Viewport<'a>
pub fn tool(self, tool: Tool) -> Viewport<'a>
The tool active over the viewport, which decides the cursor (default: none, the system’s arrow).
Sourcepub fn source(self, source: &'a dyn TileSource) -> Viewport<'a>
pub fn source(self, source: &'a dyn TileSource) -> Viewport<'a>
Where the pixels come from (its size is the image’s unless
Viewport::image_size says otherwise).
Sourcepub fn before(self, source: &'a dyn TileSource) -> Viewport<'a>
pub fn before(self, source: &'a dyn TileSource) -> Viewport<'a>
The “before” image of a comparison (deliver to
ViewportState::before_sink).
Sourcepub fn compare(self, compare: Compare) -> Viewport<'a>
pub fn compare(self, compare: Compare) -> Viewport<'a>
How “before” and “after” are shown (the application keeps it and
applies the Compare signals).
Sourcepub fn overlays(self, overlays: &'a [Overlay]) -> Viewport<'a>
pub fn overlays(self, overlays: &'a [Overlay]) -> Viewport<'a>
Overlays in image coordinates, drawn over the image, their
handles dragged through Handle signals.
Sourcepub fn readout(self, on: bool) -> Viewport<'a>
pub fn readout(self, on: bool) -> Viewport<'a>
Shows the source’s values under the pointer in a corner (they are in the output and signalled either way).
Sourcepub fn image_size(self, size: [u32; 2]) -> Viewport<'a>
pub fn image_size(self, size: [u32; 2]) -> Viewport<'a>
The image’s size in pixels.
Sourcepub fn label(self, label: impl Into<String>) -> Viewport<'a>
pub fn label(self, label: impl Into<String>) -> Viewport<'a>
The accessible name (default “Image viewport”).
Sourcepub fn pixel_grid(self, on: bool) -> Viewport<'a>
pub fn pixel_grid(self, on: bool) -> Viewport<'a>
Draws the pixel grid from GRID_FROM_ZOOM up (default on).
Sourcepub fn size(self, size: Vec2) -> Viewport<'a>
pub fn size(self, size: Vec2) -> Viewport<'a>
The widget’s size in points (default: all the space available).
Sourcepub fn show(
self,
ui: &mut Ui,
state: &mut ViewportState,
view: &mut View,
) -> ViewportOutput
pub fn show( self, ui: &mut Ui, state: &mut ViewportState, view: &mut View, ) -> ViewportOutput
Draws the viewport and handles its gestures.
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for Viewport<'a>
impl<'a> !RefUnwindSafe for Viewport<'a>
impl<'a> !Send for Viewport<'a>
impl<'a> !Sync for Viewport<'a>
impl<'a> Unpin for Viewport<'a>
impl<'a> UnsafeUnpin for Viewport<'a>
impl<'a> !UnwindSafe for Viewport<'a>
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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<F, T, S> SimdInto<T, S> for Fwhere
T: SimdFrom<F, S>,
S: Simd,
impl<F, T, S> SimdInto<T, S> for Fwhere
T: SimdFrom<F, S>,
S: Simd,
§impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
§fn to_owned_obj(&self, data: FontData<'_>) -> U
fn to_owned_obj(&self, data: FontData<'_>) -> U
T, using the provided data to resolve any offsets.