Skip to main content

Canvas

Trait Canvas 

Source
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§

Source

fn set_cursor(&mut self, cursor: Cursor)

Source

fn cursor(&self) -> Option<Cursor>

The cursor set on this canvas so far this frame, which the shell publishes once the frame is done.

Source

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.

Source

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.

Source

fn request_repaint(&self)

Source

fn request_repaint_after(&self, after: Duration)

Source

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).

Source

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.

Implementors§