pub trait DisplayNode<N, E, Ty, Ix>: Clone + From<NodeProps<N>>{
// Required methods
fn closest_boundary_point(&self, dir: Vec2) -> Pos2;
fn shapes(&mut self, ctx: &DrawContext<'_>) -> Vec<Shape>;
fn update(&mut self, state: &NodeProps<N>);
fn is_inside(&self, pos: Pos2) -> bool;
}
Required Methods§
Sourcefn closest_boundary_point(&self, dir: Vec2) -> Pos2
fn closest_boundary_point(&self, dir: Vec2) -> Pos2
Returns the closest point on the shape boundary in the direction of dir.
dir
- direction pointing from the shape center to the required boundary point.
Could be used to snap the edge ends to the node.
Sourcefn shapes(&mut self, ctx: &DrawContext<'_>) -> Vec<Shape>
fn shapes(&mut self, ctx: &DrawContext<'_>) -> Vec<Shape>
Draws shapes of the node. If the node is interacted these shapes will be used for drawing on foreground layer, otherwise on background layer. Has mutable reference to itself for possibility to change internal state for the visualizations where this is important.
ctx
- containsegui::Context
and graph metadata.
Use ctx.meta
to properly scale and translate the shape.
Use ctx.painter
to have low level access to egui painting process.
Sourcefn update(&mut self, state: &NodeProps<N>)
fn update(&mut self, state: &NodeProps<N>)
Is called on every frame. Can be used for updating state of the implementation of DisplayNode
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.