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: usizeUnique 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
impl FlowCore
Sourcepub fn claim_pointer(&self) -> bool
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.
Sourcepub fn release_pointer(&self)
pub fn release_pointer(&self)
Release a claim taken with claim_pointer.
Sourcepub fn begin_pan(&self, pointer_id: i32, client: Point) -> bool
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.
Sourcepub fn client_to_flow(&self, client: Point) -> Point
pub fn client_to_flow(&self, client: Point) -> Point
Convert client (page) coordinates to flow coordinates.
Sourcepub fn flow_to_client(&self, flow: Point) -> Point
pub fn flow_to_client(&self, flow: Point) -> Point
Convert flow coordinates to client (page) coordinates.
Sourcepub fn cancel_animations(&self)
pub fn cancel_animations(&self)
Cancel any in-flight animation.
Sourcepub fn nodes_bounds(&self) -> Option<Rect>
pub fn nodes_bounds(&self) -> Option<Rect>
Bounding box of all nodes in flow coordinates, if any.
Sourcepub fn set_viewport(&self, target: Viewport, duration_ms: u64)
pub fn set_viewport(&self, target: Viewport, duration_ms: u64)
Animate (or jump, with duration_ms == 0) to the given viewport.
Sourcepub fn zoom_by(
&self,
factor: f64,
anchor_client: Option<Point>,
duration_ms: u64,
)
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.
pub fn zoom_in(&self, duration_ms: u64)
pub fn zoom_out(&self, duration_ms: u64)
Sourcepub fn fit_bounds(&self, bounds: Rect, padding: f64, duration_ms: u64)
pub fn fit_bounds(&self, bounds: Rect, padding: f64, duration_ms: u64)
Fit the given flow-space bounds into the container.