pub struct Element {
pub shape: ShapeKind,
pub pos: Position,
pub look: StyleAttr,
pub orientation: Orientation,
pub properties: Option<String>,
}
Fields§
§shape: ShapeKind
§pos: Position
§look: StyleAttr
§orientation: Orientation
§properties: Option<String>
Implementations§
Source§impl Element
impl Element
pub fn create( shape: ShapeKind, look: StyleAttr, orientation: Orientation, size: Point, ) -> Element
pub fn create_with_properties( shape: ShapeKind, look: StyleAttr, orientation: Orientation, size: Point, properties: impl Into<String>, ) -> Element
pub fn create_connector( label: &str, look: &StyleAttr, dir: Orientation, ) -> Element
pub fn empty_connector(dir: Orientation) -> Element
pub fn move_to(&mut self, to: Point)
Trait Implementations§
Source§impl Renderable for Element
impl Renderable for Element
Source§fn render(&self, debug: bool, canvas: &mut dyn RenderBackend)
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)
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)
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.
Auto Trait Implementations§
impl Freeze for Element
impl RefUnwindSafe for Element
impl Send for Element
impl Sync for Element
impl Unpin for Element
impl UnwindSafe for Element
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more