pub struct CanvasEditor { /* private fields */ }Implementations§
Source§impl CanvasEditor
impl CanvasEditor
pub fn new(document: CanvasDocument) -> Self
pub fn new_with_router<R>(document: CanvasDocument, edge_router: R) -> Self
pub fn try_new_with_kind_registry( document: CanvasDocument, kind_registry: CanvasKindRegistry, ) -> Result<Self, DocumentError>
pub fn try_new_with_router_and_kind_registry<R>( document: CanvasDocument, edge_router: R, kind_registry: CanvasKindRegistry, ) -> Result<Self, DocumentError>
pub fn apply(&mut self, command: DocumentCommand) -> Result<(), DocumentError>
pub fn apply_all( &mut self, commands: impl IntoIterator<Item = DocumentCommand>, ) -> Result<(), DocumentError>
pub fn document(&self) -> &CanvasDocument
pub fn viewport(&self) -> CanvasViewport
pub fn tool(&self) -> &CanvasTool
pub fn runtime(&self) -> &CanvasRuntime
pub fn edge_router(&self) -> &(dyn CanvasEdgeRouter + Send + Sync)
pub fn kind_registry(&self) -> &CanvasKindRegistry
pub fn selection(&self) -> &CanvasSelection
pub fn history(&self) -> &CanvasHistory
pub fn store(&self) -> &CanvasStore
pub fn listen( &mut self, listener: impl Fn(&CanvasStoreChange) + Send + Sync + 'static, ) -> CanvasStoreListenerId
pub fn remove_listener(&mut self, id: CanvasStoreListenerId) -> bool
pub fn apply_transaction( &mut self, transaction: CanvasTransaction, ) -> Result<(), DocumentError>
pub fn apply_transaction_with_diff( &mut self, transaction: CanvasTransaction, ) -> Result<CanvasDocumentDiff, DocumentError>
pub fn apply_tool_intent( &mut self, intent: CanvasToolIntent, ) -> Result<(), DocumentError>
pub fn undo(&mut self) -> Result<bool, DocumentError>
pub fn redo(&mut self) -> Result<bool, DocumentError>
pub fn rebuild_index(&mut self)
pub fn rebuild_runtime(&mut self)
pub fn set_edge_router<R>(&mut self, edge_router: R)
pub fn set_kind_registry( &mut self, kind_registry: CanvasKindRegistry, ) -> Result<(), DocumentError>
pub fn set_tool(&mut self, tool: CanvasTool) -> Result<(), DocumentError>
pub fn set_viewport(&mut self, viewport: CanvasViewport)
pub fn is_tool_state_idle(&self) -> bool
pub fn connection_drag_state(&self) -> Option<CanvasConnectionDragState>
pub fn take_connection_release(&mut self) -> Option<CanvasConnectionRelease>
pub fn tool_context(&self) -> CanvasToolContext<'_>
pub fn handle_event(&mut self, event: CanvasEvent) -> Result<(), DocumentError>
pub fn delete_selection(&mut self) -> Result<bool, DocumentError>
pub fn copy_selection(&self) -> Option<CanvasClipboardPayload>
pub fn cut_selection( &mut self, ) -> Result<Option<CanvasClipboardPayload>, DocumentError>
pub fn paste_clipboard( &mut self, payload: &CanvasClipboardPayload, offset: Point<Pixels>, ) -> Result<bool, DocumentError>
pub fn duplicate_selection( &mut self, offset: Point<Pixels>, ) -> Result<bool, DocumentError>
pub fn group_selection( &mut self, group_id: impl Into<ShapeId>, ) -> Result<bool, DocumentError>
pub fn ungroup_selection(&mut self) -> Result<bool, DocumentError>
pub fn reorder_selection( &mut self, command: CanvasZOrderCommand, ) -> Result<bool, DocumentError>
pub fn handle_event_with_custom_tool<T>(
&mut self,
event: CanvasEvent,
custom_tool: &mut T,
) -> Result<(), DocumentError>where
T: CanvasToolReducer + ?Sized,
pub fn handle_event_with_tool_registry( &mut self, event: CanvasEvent, registry: &mut CanvasToolRegistry, ) -> Result<(), CanvasToolRegistryError>
Trait Implementations§
Source§impl Default for CanvasEditor
impl Default for CanvasEditor
Source§impl From<&CanvasEditor> for CanvasPaintModel
impl From<&CanvasEditor> for CanvasPaintModel
Source§fn from(editor: &CanvasEditor) -> Self
fn from(editor: &CanvasEditor) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl !RefUnwindSafe for CanvasEditor
impl !UnwindSafe for CanvasEditor
impl Freeze for CanvasEditor
impl Send for CanvasEditor
impl Sync for CanvasEditor
impl Unpin for CanvasEditor
impl UnsafeUnpin for CanvasEditor
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as
ReadEndian::read_from_little_endian().