pub struct Force<N, E, Ty = Undirected> {
pub dict: LinkedHashMap<String, Value>,
pub dict_default: LinkedHashMap<String, Value>,
pub name: &'static str,
pub continuous: bool,
pub info: Option<&'static str>,
pub update: fn(dict: &LinkedHashMap<String, Value>, graph: &mut ForceGraph<N, E, Ty>, dt: f32),
}
Expand description
A struct that defines how your force behaves.
Fields§
§dict: LinkedHashMap<String, Value>
Current dictionary
dict_default: LinkedHashMap<String, Value>
Default dictionary
name: &'static str
Name of the force
continuous: bool
Whether or not the force should be run on each frame.
info: Option<&'static str>
A short description of the force.
update: fn(dict: &LinkedHashMap<String, Value>, graph: &mut ForceGraph<N, E, Ty>, dt: f32)
Force callback function.
Implementations§
source§impl<N, E, Ty> Force<N, E, Ty>
impl<N, E, Ty> Force<N, E, Ty>
sourcepub fn update(&self, graph: &mut ForceGraph<N, E, Ty>, dt: f32)
pub fn update(&self, graph: &mut ForceGraph<N, E, Ty>, dt: f32)
Update the graph’s node’s positions for a given interval.
sourcepub fn dict_mut(&mut self) -> &mut LinkedHashMap<String, Value>
pub fn dict_mut(&mut self) -> &mut LinkedHashMap<String, Value>
Retrieve a mutable reference to the force’s internal dictionary.
sourcepub fn dict(&self) -> &LinkedHashMap<String, Value>
pub fn dict(&self) -> &LinkedHashMap<String, Value>
Retrieve a reference to the force’s internal dictionary.
sourcepub fn continuous(&self) -> bool
pub fn continuous(&self) -> bool
Retrieve if the force is continuous. Continuous forces run their update on every frame, non-continuous forces run their update every time the user clicks a “Run” button.