jcberentsen/elm-wiring-diagrams/1.1.0

NOTE: the latest version is 5.4.7

WiringDiagram.Layout

Layout of WiringDiagram values

Typically a Layout can be converted to SVG for display

Definition

type Layout a
= Group
{ transform : Transform
, exterior : Maybe (Box a)
, interiorTransform : Transform
, interior : List (Layout a)
}
| Item (Box a)
| Arrow
{ label : String
, tail : Vec2
, head : Vec2
}

The Layout type keeps information about the layout of a Wiring diagram.

Simple Layout of a Diagram

Layout a Diagram with default configuration

Customized Layout of a Diagram

Layout a Diagram with custom configuration

Misc

= In
| Out

Polarity of a Port. Is the port going In or Out of something

type alias Pos =
Vec2

A type for Positions

type alias Transform =
Vec2

Transform only supports simple 2d translation

{ a | tail : b, head : c }
-> { lo : b
, hi : c
}

Make an extent for an Arrow. This stupidly assumes the tail is < head

portPositionsOfBox : Polarity -> Box a -> List ( Int, Pos )

List the port positions of a Box, given a Polarity (In,Out)