pub struct CanvasZoom { /* private fields */ }Expand description
A zoom control for any canvas: zoom out, the zoom in percent (a menu
of fit, frame the selection, 100 % and the steps), zoom in, and hand
mode. It sends the canvas commands (view.zoom_out, view.fit,
view.zoom_to:200…) to the canvas it drives through
egui_pop_core::canvas, and shows the zoom the canvas published;
each button’s tooltip says its keys.
use egui_pop_viewport::graph::GraphEditor;
use egui_pop_viewport::navigation::CanvasZoom;
let out = GraphEditor::new(graph, state).show(ui);
CanvasZoom::new(out.canvas).show(ui);Implementations§
Source§impl CanvasZoom
impl CanvasZoom
Sourcepub fn new(canvas: Id) -> CanvasZoom
pub fn new(canvas: Id) -> CanvasZoom
Drives a canvas by its id (GraphOutput::canvas,
ViewportOutput::canvas).
Sourcepub fn active() -> CanvasZoom
pub fn active() -> CanvasZoom
Drives the canvas in use, else the one used last (a toolbar’s control for every canvas of a window).
Sourcepub fn steps(self, steps: impl IntoIterator<Item = u32>) -> CanvasZoom
pub fn steps(self, steps: impl IntoIterator<Item = u32>) -> CanvasZoom
The menu’s steps, in percent.
Shows the hand mode button (default: on).
Sourcepub fn frame_selection(self, on: bool) -> CanvasZoom
pub fn frame_selection(self, on: bool) -> CanvasZoom
Offers “frame the selection” in the menu (default: on; off for a canvas without a selection, an image).
Trait Implementations§
Source§impl Clone for CanvasZoom
impl Clone for CanvasZoom
Source§fn clone(&self) -> CanvasZoom
fn clone(&self) -> CanvasZoom
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for CanvasZoom
impl RefUnwindSafe for CanvasZoom
impl Send for CanvasZoom
impl Sync for CanvasZoom
impl Unpin for CanvasZoom
impl UnsafeUnpin for CanvasZoom
impl UnwindSafe for CanvasZoom
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> 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>
Convert
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>
Convert
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)
Convert
&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)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§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>
Converts
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>
Converts
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
Convert this type into
T, using the provided data to resolve any offsets.