Struct GraphEditor
pub struct GraphEditor {
pub selection: BTreeSet<String>,
pub pan: GraphPoint,
pub zoom: f64,
/* private fields */
}Expand description
Device-local canvas state. It is deliberately separate from Graph: a
collaborator panning their view must not move everyone else’s workspace.
Fields§
§selection: BTreeSet<String>§pan: GraphPoint§zoom: f64Implementations§
§impl GraphEditor
impl GraphEditor
pub fn connection_targets(
graph: &Graph,
from_node: &str,
from_port: &str,
) -> Vec<ConnectionTarget>
pub fn connection_targets( graph: &Graph, from_node: &str, from_port: &str, ) -> Vec<ConnectionTarget>
Compatible inputs in deterministic graph order. Applications can use this shared traversal instead of inventing pointer-only graph controls.
pub fn next_connection_target(
graph: &Graph,
from_node: &str,
from_port: &str,
current: Option<&ConnectionTarget>,
backwards: bool,
) -> Option<ConnectionTarget>
pub fn next_connection_target( graph: &Graph, from_node: &str, from_port: &str, current: Option<&ConnectionTarget>, backwards: bool, ) -> Option<ConnectionTarget>
Move through compatible inputs, wrapping at either end. None enters
the list at its first (or last) item.
pub fn select_only(&mut self, id: impl Into<String>)
pub fn zoom_about(&mut self, screen: GraphPoint, factor: f64)
pub fn screen_position(&self, p: GraphPoint) -> GraphPoint
pub fn begin_node_drag(
&mut self,
graph: &Graph,
id: &str,
pointer: GraphPoint,
) -> bool
pub fn begin_node_drag( &mut self, graph: &Graph, id: &str, pointer: GraphPoint, ) -> bool
Begin moving one node from a pointer expressed in graph-screen space. The domain graph owns the durable position; this editor owns only the transient gesture so every graph-based app gets identical behavior.
pub fn update_node_drag(&self, graph: &mut Graph, pointer: GraphPoint) -> bool
pub fn update_node_drag(&self, graph: &mut Graph, pointer: GraphPoint) -> bool
Apply a held drag. Dividing by zoom keeps the node under the pointer at every scale rather than making movement too fast or too slow.
pub fn end_node_drag(&mut self) -> Option<String>
pub fn is_dragging_node(&self) -> bool
pub fn begin_pan(&mut self, pointer: GraphPoint) -> bool
pub fn begin_pan(&mut self, pointer: GraphPoint) -> bool
Begin moving the viewport from empty canvas. Node and viewport drags are mutually exclusive, preventing a second touch from stealing the active gesture.
pub fn update_pan(&mut self, pointer: GraphPoint) -> bool
pub fn end_pan(&mut self) -> bool
pub fn is_panning(&self) -> bool
pub fn begin_connection( &mut self, graph: &Graph, from_node: &str, from_port: &str, pointer: GraphPoint, ) -> bool
pub fn update_connection(&mut self, pointer: GraphPoint) -> bool
pub fn connection_preview(&self) -> Option<(&str, &str, GraphPoint)>
pub fn finish_connection(
&mut self,
graph: &mut Graph,
to_node: &str,
to_port: &str,
) -> Result<Option<Edge>, ConnectError>
pub fn finish_connection( &mut self, graph: &mut Graph, to_node: &str, to_port: &str, ) -> Result<Option<Edge>, ConnectError>
Complete the active connection gesture against a target input.
§Errors
Returns ConnectError::UnknownPort when no gesture is active, or
forwards the graph’s validation error when the proposed edge is not
structurally valid.
pub fn is_connecting(&self) -> bool
Trait Implementations§
§impl Clone for GraphEditor
impl Clone for GraphEditor
§fn clone(&self) -> GraphEditor
fn clone(&self) -> GraphEditor
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl Debug for GraphEditor
impl Debug for GraphEditor
§impl Default for GraphEditor
impl Default for GraphEditor
§fn default() -> GraphEditor
fn default() -> GraphEditor
§impl PartialEq for GraphEditor
impl PartialEq for GraphEditor
impl StructuralPartialEq for GraphEditor
Auto Trait Implementations§
impl Freeze for GraphEditor
impl RefUnwindSafe for GraphEditor
impl Send for GraphEditor
impl Sync for GraphEditor
impl Unpin for GraphEditor
impl UnsafeUnpin for GraphEditor
impl UnwindSafe for GraphEditor
Blanket Implementations§
§impl<T> AnyEq for T
impl<T> AnyEq for T
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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>
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>
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 more