pub struct Canvas {
rect: Rect,
response: Response,
diagram: ShapeIdx,
pan: Camera,
moves: Vec<Move>,
}Expand description
One canvas frame as the pointer left it: the rect it was laid out in, the moves it read for the session to apply, and the raw input the session resolves. A value rather than a borrow of the view, so the frame can call the editor between reading its input and painting.
Fields§
§rect: Rect§response: Response§diagram: ShapeIdxWhere the diagram is painted, reserved as the canvas is laid out.
pan: Camera§moves: Vec<Move>Implementations§
Source§impl Canvas
impl Canvas
Sourcepub fn moves(&mut self) -> Vec<Move>
pub fn moves(&mut self) -> Vec<Move>
What the pointer did to the camera this frame — a drag pan, a wheel notch, a pinch — in the order it happened, for the session to apply before the pointer is resolved.
Sourcepub fn input(&self, ui: &Ui, glass: &[Rect]) -> Input
pub fn input(&self, ui: &Ui, glass: &[Rect]) -> Input
What the pointer and the keys did this frame, as the core resolves them: the pointer’s motions and button edges while it is over the canvas or holding a press that began there, its leaving otherwise, and a pan in progress, which owns the pointer.
Presses that began on a toolbar button never arrive: holding one —
whose screen point maps to some world position — must not arm a
canvas affordance. egui keeps that promise for chrome in a layer of
its own; for chrome the host draws in the canvas’s layer it counts
the canvas as hovered on the press and not on the release, so the
host names the rects of such chrome as glass, and a press on one
is not taken either.
Auto Trait Implementations§
impl Freeze for Canvas
impl !RefUnwindSafe for Canvas
impl Send for Canvas
impl Sync for Canvas
impl Unpin for Canvas
impl UnsafeUnpin for Canvas
impl !UnwindSafe for Canvas
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> 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