pub struct Context {
pub io: IO,
pub style: Style,
/* private fields */
}
Expand description
The Context that tracks the state of the node editor
Fields§
§io: IO
§style: Style
Implementations§
Source§impl Context
impl Context
Sourcepub fn show<'a>(
&mut self,
nodes: impl IntoIterator<Item = NodeConstructor<'a>>,
links: impl IntoIterator<Item = (usize, usize, usize, LinkArgs)>,
ui: &mut Ui,
) -> Response
pub fn show<'a>( &mut self, nodes: impl IntoIterator<Item = NodeConstructor<'a>>, links: impl IntoIterator<Item = (usize, usize, usize, LinkArgs)>, ui: &mut Ui, ) -> Response
Displays the current state of the editor on a give Egui Ui as well as updating user input to the context
Sourcepub fn attribute_flag_push(&mut self, flag: AttributeFlags)
pub fn attribute_flag_push(&mut self, flag: AttributeFlags)
Push a sigle AttributeFlags value, by default only None is set. Used for pins that don’t have a specific attribute flag specified
Sourcepub fn attribute_flag_pop(&mut self)
pub fn attribute_flag_pop(&mut self)
Remove the last added AttributeFlags value
Sourcepub fn color_style_push(&mut self, item: ColorStyle, color: Color32)
pub fn color_style_push(&mut self, item: ColorStyle, color: Color32)
Changes the current colors used by the editor
Sourcepub fn color_style_pop(&mut self)
pub fn color_style_pop(&mut self)
Revert the last color change
Sourcepub fn style_var_push(&mut self, item: StyleVar, value: f32)
pub fn style_var_push(&mut self, item: StyleVar, value: f32)
Change a context style value
Sourcepub fn style_var_pop(&mut self)
pub fn style_var_pop(&mut self)
Revert the last context style change
pub fn set_node_pos_screen_space( &mut self, node_id: usize, screen_space_pos: Pos2, )
pub fn set_node_pos_editor_space( &mut self, node_id: usize, editor_space_pos: Pos2, )
pub fn set_node_pos_grid_space(&mut self, node_id: usize, grid_pos: Pos2)
pub fn set_node_draggable(&mut self, node_id: usize, draggable: bool)
pub fn get_node_pos_screen_space(&self, node_id: usize) -> Option<Pos2>
pub fn get_node_pos_editor_space(&self, node_id: usize) -> Option<Pos2>
pub fn get_node_pos_grid_space(&self, node_id: usize) -> Option<Pos2>
Sourcepub fn node_hovered(&self) -> Option<usize>
pub fn node_hovered(&self) -> Option<usize>
Check if there is a node that is hovered by the pointer
Sourcepub fn link_hovered(&self) -> Option<usize>
pub fn link_hovered(&self) -> Option<usize>
Check if there is a link that is hovered by the pointer
Sourcepub fn pin_hovered(&self) -> Option<usize>
pub fn pin_hovered(&self) -> Option<usize>
Check if there is a pin that is hovered by the pointer
pub fn num_selected_nodes(&self) -> usize
pub fn get_selected_nodes(&self) -> Vec<usize>
pub fn get_selected_links(&self) -> Vec<usize>
pub fn clear_node_selection(&mut self)
pub fn clear_link_selection(&mut self)
Sourcepub fn active_attribute(&self) -> Option<usize>
pub fn active_attribute(&self) -> Option<usize>
Check if an attribute is currently being interacted with
Sourcepub fn link_started(&self) -> Option<usize>
pub fn link_started(&self) -> Option<usize>
Has a new link been created from a pin?
Sourcepub fn link_dropped(&self, including_detached_links: bool) -> Option<usize>
pub fn link_dropped(&self, including_detached_links: bool) -> Option<usize>
Has a link been dropped? if including_detached_links then links that were detached then dropped are included
Sourcepub fn link_created(&self) -> Option<(usize, usize, bool)>
pub fn link_created(&self) -> Option<(usize, usize, bool)>
Has a new link been created? -> Option<start_pin, end_pin created_from_snap>
Sourcepub fn link_created_node(&self) -> Option<(usize, usize, usize, usize, bool)>
pub fn link_created_node(&self) -> Option<(usize, usize, usize, usize, bool)>
Has a new link been created? Includes start and end node -> Option<start_pin, start_node, end_pin, end_node created_from_snap>