pub struct FlowHandle<T: 'static = ()> { /* private fields */ }Expand description
A handle for controlling a crate::Flow from the component that owns it.
ⓘ
let flow = use_flow_handle();
rsx! {
button { onclick: move |_| flow.auto_layout(&LayoutOptions::default()), "Layout" }
Flow { nodes, edges, handle: flow }
}Implementations§
Source§impl<T: Clone + PartialEq + 'static> FlowHandle<T>
impl<T: Clone + PartialEq + 'static> FlowHandle<T>
pub fn set_viewport(&self, viewport: Viewport, duration_ms: u64)
pub fn fit_view(&self, duration_ms: u64)
pub fn zoom_in(&self, duration_ms: u64)
pub fn zoom_out(&self, duration_ms: u64)
Sourcepub fn client_to_flow(&self, client: Point) -> Option<Point>
pub fn client_to_flow(&self, client: Point) -> Option<Point>
Convert client (page) coordinates to flow coordinates, e.g. for placing a node at a click position.
Sourcepub fn delete_selected(&self)
pub fn delete_selected(&self)
Delete the selected nodes (with their edges) and selected edges — the
same cascade the Delete key performs by default. Call this from an
on_delete handler after confirming or snapshotting for undo.
Sourcepub fn auto_layout(&self, opts: &LayoutOptions)
pub fn auto_layout(&self, opts: &LayoutOptions)
Re-layout the graph with animated node movement, then fit it into
view. Handle sides follow the layout direction when
opts.update_handle_sides is set.
Trait Implementations§
Source§impl<T> Clone for FlowHandle<T>
impl<T> Clone for FlowHandle<T>
impl<T> Copy for FlowHandle<T>
Auto Trait Implementations§
impl<T = ()> !RefUnwindSafe for FlowHandle<T>
impl<T = ()> !Send for FlowHandle<T>
impl<T = ()> !Sync for FlowHandle<T>
impl<T = ()> !UnwindSafe for FlowHandle<T>
impl<T> Freeze for FlowHandle<T>
impl<T> Unpin for FlowHandle<T>where
T: Unpin,
impl<T> UnsafeUnpin for FlowHandle<T>
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> DependencyElement for T
Source§impl<T> InitializeFromFunction<T> for T
impl<T> InitializeFromFunction<T> for T
Source§fn initialize_from_function(f: fn() -> T) -> T
fn initialize_from_function(f: fn() -> T) -> T
Create an instance of this type from an initialization function
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<Ret> SpawnIfAsync<(), Ret> for Ret
impl<Ret> SpawnIfAsync<(), Ret> for Ret
Source§impl<T, O> SuperFrom<T> for Owhere
O: From<T>,
impl<T, O> SuperFrom<T> for Owhere
O: From<T>,
Source§fn super_from(input: T) -> O
fn super_from(input: T) -> O
Convert from a type to another type.
Source§impl<T, O, M> SuperInto<O, M> for Twhere
O: SuperFrom<T, M>,
impl<T, O, M> SuperInto<O, M> for Twhere
O: SuperFrom<T, M>,
Source§fn super_into(self) -> O
fn super_into(self) -> O
Convert from a type to another type.