pub struct Minimap { /* private fields */ }Expand description
A small copy of the content with a rectangle around what is in view, linked to a
ZoomPanView by the same ZoomView. A press or a drag moves the view there, and so do
the arrow keys (with Shift, further).
use ravenrs_core::{Color, ImageData, Size};
use ravenrs_reactive::State;
use ravenrs_widgets::{Minimap, ZoomView};
let view = State::new(ZoomView::at(2.0));
if let Some(thumbnail) = ImageData::from_fn(64, 48, |_, _| Color::rgb(0.3, 0.4, 0.5)) {
let map = Minimap::image(view.binding(), thumbnail).content_size(Size::new(6400.0, 4800.0));
}Implementations§
Source§impl Minimap
impl Minimap
Sourcepub fn image(view: Binding<ZoomView>, image: ImageData) -> Minimap
pub fn image(view: Binding<ZoomView>, image: ImageData) -> Minimap
A map showing image, usually a small version of the content.
Sourcepub fn custom(
view: Binding<ZoomView>,
content: Size,
draw: impl Fn(ZoomPanPaint, &mut Scene) + 'static,
) -> Minimap
pub fn custom( view: Binding<ZoomView>, content: Size, draw: impl Fn(ZoomPanPaint, &mut Scene) + 'static, ) -> Minimap
A map showing what draw draws, for content of this size in units of the caller.
Sourcepub fn content_size(self, content: Size) -> Minimap
pub fn content_size(self, content: Size) -> Minimap
The size of the content the view shows, when image is a smaller version of it.
Sourcepub fn max_size(self, width: f32, height: f32) -> Minimap
pub fn max_size(self, width: f32, height: f32) -> Minimap
The most width and height, in logical pixels (160 each by default). The map takes the proportions of the content inside that.
Sourcepub fn press_zoom(self, scale: f32) -> Minimap
pub fn press_zoom(self, scale: f32) -> Minimap
A press while everything is in view zooms to this scale, there. Without it, such a press does nothing, since there is nowhere to go.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Minimap
impl !Send for Minimap
impl !Sync for Minimap
impl !UnwindSafe for Minimap
impl Freeze for Minimap
impl Unpin for Minimap
impl UnsafeUnpin for Minimap
Blanket Implementations§
impl<T> AutoreleaseSafe for Twhere
T: ?Sized,
impl<T> AutoreleaseSafe for Twhere
T: ?Sized,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<S, T> Duplex<S> for Twhere
T: FromSample<S> + ToSample<S>,
impl<T> ErasedDestructor for Twhere
T: 'static,
§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> 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> ⓘ
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
§impl<T, U> ToSample<U> for Twhere
U: FromSample<T>,
impl<T, U> ToSample<U> for Twhere
U: FromSample<T>,
fn to_sample_(self) -> U
Source§impl<V> ViewExt for Vwhere
V: View,
impl<V> ViewExt for Vwhere
V: View,
Source§fn padding(self, padding: impl Into<Insets>) -> Styled<Self>
fn padding(self, padding: impl Into<Insets>) -> Styled<Self>
Adds padding inside the box, in logical pixels.
Source§fn background(self, fill: impl Into<Fill>) -> Styled<Self>
fn background(self, fill: impl Into<Fill>) -> Styled<Self>
Paints a background behind the content.
Source§fn frame(self, width: Option<f32>, height: Option<f32>) -> Styled<Self>
fn frame(self, width: Option<f32>, height: Option<f32>) -> Styled<Self>
Fixes the width and/or height in logical pixels;
None keeps the content size.