GraphEditorState

Struct GraphEditorState 

Source
pub struct GraphEditorState<NodeData, DataType, ValueType, NodeTemplate, UserState> {
    pub graph: Graph<NodeData, DataType, ValueType>,
    pub node_order: Vec<NodeId>,
    pub connection_in_progress: Option<(NodeId, AnyParameterId)>,
    pub selected_nodes: Vec<NodeId>,
    pub ongoing_box_selection: Option<Pos2>,
    pub node_positions: SecondaryMap<NodeId, Pos2>,
    pub node_orientations: SecondaryMap<NodeId, NodeOrientation>,
    pub node_finder: Option<NodeFinder<NodeTemplate>>,
    pub pan_zoom: PanZoom,
    pub _user_state: PhantomData<fn() -> UserState>,
}

Fields§

§graph: Graph<NodeData, DataType, ValueType>§node_order: Vec<NodeId>

Nodes are drawn in this order. Draw order is important because nodes that are drawn last are on top.

§connection_in_progress: Option<(NodeId, AnyParameterId)>

An ongoing connection interaction: The mouse has dragged away from a port and the user is holding the click

§selected_nodes: Vec<NodeId>

The currently selected node. Some interface actions depend on the currently selected node.

§ongoing_box_selection: Option<Pos2>

The mouse drag start position for an ongoing box selection.

§node_positions: SecondaryMap<NodeId, Pos2>

The position of each node.

§node_orientations: SecondaryMap<NodeId, NodeOrientation>

Orientation of each node

§node_finder: Option<NodeFinder<NodeTemplate>>

The node finder is used to create new nodes.

§pan_zoom: PanZoom

The panning of the graph viewport.

§_user_state: PhantomData<fn() -> UserState>

Implementations§

Source§

impl<NodeData, DataType: PartialEq, ValueType, NodeKind, UserState> GraphEditorState<NodeData, DataType, ValueType, NodeKind, UserState>

Source

pub fn new(default_zoom: f32) -> Self

Source§

impl<NodeData, DataType, ValueType, NodeTemplate, UserResponse, UserState, CategoryType> GraphEditorState<NodeData, DataType, ValueType, NodeTemplate, UserState>
where NodeData: NodeDataTrait<Response = UserResponse, UserState = UserState, DataType = DataType, ValueType = ValueType>, UserResponse: UserResponseTrait, ValueType: WidgetValueTrait<Response = UserResponse, UserState = UserState, NodeData = NodeData>, NodeTemplate: NodeTemplateTrait<NodeData = NodeData, DataType = DataType, ValueType = ValueType, UserState = UserState, CategoryType = CategoryType>, DataType: DataTypeTrait<UserState>, CategoryType: CategoryTrait,

Source

pub fn draw_graph_editor( &mut self, ui: &mut Ui, all_kinds: impl NodeTemplateIter<Item = NodeTemplate>, user_state: &mut UserState, prepend_responses: Vec<NodeResponse<UserResponse, NodeData>>, ) -> GraphResponse<UserResponse, NodeData>

Source

pub fn reset_zoom(&mut self, ui: &Ui)

Reset zoom to 1.0

Source

pub fn zoom(&mut self, ui: &Ui, zoom_delta: f32)

Zoom within the where you call draw_graph_editor. Use values like 1.01, or 0.99 to zoom. For example: let zoom_delta = (scroll_delta * 0.002).exp();

Trait Implementations§

Source§

impl<NodeData: Clone, DataType: Clone, ValueType: Clone, NodeTemplate: Clone, UserState: Clone> Clone for GraphEditorState<NodeData, DataType, ValueType, NodeTemplate, UserState>

Source§

fn clone( &self, ) -> GraphEditorState<NodeData, DataType, ValueType, NodeTemplate, UserState>

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<NodeData, DataType: PartialEq, ValueType, NodeKind, UserState> Default for GraphEditorState<NodeData, DataType, ValueType, NodeKind, UserState>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<NodeData, DataType, ValueType, NodeTemplate, UserState> Freeze for GraphEditorState<NodeData, DataType, ValueType, NodeTemplate, UserState>

§

impl<NodeData, DataType, ValueType, NodeTemplate, UserState> !RefUnwindSafe for GraphEditorState<NodeData, DataType, ValueType, NodeTemplate, UserState>

§

impl<NodeData, DataType, ValueType, NodeTemplate, UserState> Send for GraphEditorState<NodeData, DataType, ValueType, NodeTemplate, UserState>
where NodeTemplate: Send, NodeData: Send, DataType: Send, ValueType: Send,

§

impl<NodeData, DataType, ValueType, NodeTemplate, UserState> Sync for GraphEditorState<NodeData, DataType, ValueType, NodeTemplate, UserState>
where NodeTemplate: Sync, NodeData: Sync, DataType: Sync, ValueType: Sync,

§

impl<NodeData, DataType, ValueType, NodeTemplate, UserState> Unpin for GraphEditorState<NodeData, DataType, ValueType, NodeTemplate, UserState>
where NodeTemplate: Unpin, NodeData: Unpin, DataType: Unpin, ValueType: Unpin,

§

impl<NodeData, DataType, ValueType, NodeTemplate, UserState> !UnwindSafe for GraphEditorState<NodeData, DataType, ValueType, NodeTemplate, UserState>

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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<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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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> SerializableAny for T
where T: 'static + Any + Clone + for<'a> Send + Sync,