Trait Renderable

Source
pub trait Renderable {
    // Required methods
    fn render(&self, debug: bool, canvas: &mut dyn RenderBackend);
    fn get_connector_location(
        &self,
        from: Point,
        force: f64,
        port: &Option<String>,
    ) -> (Point, Point);
    fn get_passthrough_path(
        &self,
        from: Point,
        to: Point,
        force: f64,
    ) -> (Point, Point);
}
Expand description

This is the trait that all elements that can be rendered on a canvas need to implement.

Required Methods§

Source

fn render(&self, debug: bool, canvas: &mut dyn RenderBackend)

Render the shape into a canvas. If \p debug is set then extra markers will be rendered.

Source

fn get_connector_location( &self, from: Point, force: f64, port: &Option<String>, ) -> (Point, Point)

\Return the coordinate for the connection point of an arrow that’s coming from the direction of \p from. The format of the path is (x, y, cx, cy), where cx and cy, are the control points of the bezier curve. \p force is the magnitude of the edge direction. \p port is the optional port name (for named records).

Source

fn get_passthrough_path( &self, from: Point, to: Point, force: f64, ) -> (Point, Point)

Computes the coordinate for the connection point of an arrow that’s passing through this edge. coming from the direction of \p from. \returns the bezier path in the format (x, y, cx, cy), where cx and cy, are the control points for the entry path of the bezier curve. The exit path is assumed to be the mirror point for the center (first point). \p force is the magnitude of the edge direction. This works with the get_connector_location method for drawing edges.

Implementors§