pub trait Canvas: Renderer + Animator {
// Required methods
fn set_cursor(&mut self, cursor: Cursor);
fn cursor(&self) -> Option<Cursor>;
fn set_edit_text(&mut self, edit: EditText);
fn remap_rect(&self, world: Rect) -> Rect;
fn request_repaint(&self);
fn request_repaint_after(&self, after: Duration);
fn now(&self) -> Duration;
fn pointer_kind(&self) -> PointerKind;
}Expand description
A Renderer that is also live: the conveniences a tool needs from the
host beyond putting marks on the diagram.
Required Methods§
fn set_cursor(&mut self, cursor: Cursor)
Sourcefn cursor(&self) -> Option<Cursor>
fn cursor(&self) -> Option<Cursor>
The cursor set on this canvas so far this frame, which the shell publishes once the frame is done.
Sourcefn set_edit_text(&mut self, edit: EditText)
fn set_edit_text(&mut self, edit: EditText)
Ask for an in-place text editor: the host runs one over edit, and
how it ends reaches the next frame’s
Interaction as a
TextOutcome.
Sourcefn remap_rect(&self, world: Rect) -> Rect
fn remap_rect(&self, world: Rect) -> Rect
World-space rect → screen-space rect, for placing screen-space chrome (the selection overlay) relative to on-canvas bounds.
fn request_repaint(&self)
fn request_repaint_after(&self, after: Duration)
Sourcefn now(&self) -> Duration
fn now(&self) -> Duration
The frame clock: monotonic time since the host started, for what is timed rather than eased toward a goal (the spotlight’s fade).
fn pointer_kind(&self) -> PointerKind
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.