Skip to main content

FlowCore

Struct FlowCore 

Source
pub struct FlowCore {
    pub iid: usize,
    pub viewport: Signal<Viewport>,
    pub container: Signal<Rect>,
    pub interaction: Signal<Interaction>,
    pub connection: Signal<Option<ConnectionState>>,
    pub handles: Signal<HashMap<HandleKey, HandleGeom>>,
    pub edges: Signal<Vec<Edge>>,
    pub geoms: Memo<Vec<NodeGeom>>,
    pub config: Signal<FlowConfig>,
    /* private fields */
}
Expand description

The non-generic heart of a flow, shared through context with every child (layers, handles, Background, Controls, MiniMap, and user components). All fields are Copy handles to reactive state.

Fields§

§iid: usize

Unique per-flow-instance id, used to namespace SVG defs.

§viewport: Signal<Viewport>§container: Signal<Rect>

Container rect in client (page) coordinates.

§interaction: Signal<Interaction>§connection: Signal<Option<ConnectionState>>§handles: Signal<HashMap<HandleKey, HandleGeom>>§edges: Signal<Vec<Edge>>§geoms: Memo<Vec<NodeGeom>>

Geometry snapshot of all nodes, derived from the node list.

§config: Signal<FlowConfig>

Implementations§

Source§

impl FlowCore

Source

pub fn claim_pointer(&self) -> bool

Claim the pointer for an application-level gesture that started on content inside the canvas, so the pane neither pans nor reports a pane click for this press. Call from a pointerdown handler (which runs before the pane’s, while the event bubbles); release the claim with release_pointer when the gesture ends — though a pointerup reaching the pane releases it too.

Returns false when some other gesture already owns the pointer.

Source

pub fn release_pointer(&self)

Release a claim taken with claim_pointer.

Source

pub fn begin_pan(&self, pointer_id: i32, client: Point) -> bool

Begin a canvas pan from an application handler — e.g. a press on an edge that selects it and then lets the canvas pan underneath. The press was on content, so the release does not count as a pane click.

client is the press position in client (page) coordinates.

Source

pub fn client_to_flow(&self, client: Point) -> Point

Convert client (page) coordinates to flow coordinates.

Source

pub fn flow_to_client(&self, flow: Point) -> Point

Convert flow coordinates to client (page) coordinates.

Source

pub fn cancel_animations(&self)

Cancel any in-flight animation.

Source

pub fn nodes_bounds(&self) -> Option<Rect>

Bounding box of all nodes in flow coordinates, if any.

Source

pub fn set_viewport(&self, target: Viewport, duration_ms: u64)

Animate (or jump, with duration_ms == 0) to the given viewport.

Source

pub fn zoom_by( &self, factor: f64, anchor_client: Option<Point>, duration_ms: u64, )

Zoom by factor keeping anchor_client (client coordinates, defaults to the container center) stationary.

Source

pub fn zoom_in(&self, duration_ms: u64)

Source

pub fn zoom_out(&self, duration_ms: u64)

Source

pub fn fit_bounds(&self, bounds: Rect, padding: f64, duration_ms: u64)

Fit the given flow-space bounds into the container.

Source

pub fn fit_view(&self, duration_ms: u64)

Fit all nodes into view.

Source

pub fn center_on(&self, flow: Point, duration_ms: u64)

Center the given flow point in the container, keeping the zoom.

Trait Implementations§

Source§

impl Clone for FlowCore

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for FlowCore

Source§

impl PartialEq for FlowCore

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DependencyElement for T
where T: 'static + PartialEq + Clone,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> InitializeFromFunction<T> for T

Source§

fn initialize_from_function(f: fn() -> T) -> T

Create an instance of this type from an initialization function
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<Ret> SpawnIfAsync<(), Ret> for Ret

Source§

fn spawn(self) -> Ret

Spawn the value into the dioxus runtime if it is an async block
Source§

impl<T, O> SuperFrom<T> for O
where O: From<T>,

Source§

fn super_from(input: T) -> O

Convert from a type to another type.
Source§

impl<T, O, M> SuperInto<O, M> for T
where O: SuperFrom<T, M>,

Source§

fn super_into(self) -> O

Convert from a type to another type.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more