Documentation
¶
Overview ¶
Package layout holds the options that change where things are: the measurer and the size of text, the width the host has, a grid to snap to, how edges are routed, and the like. A change of them lays a diagram out again; a change of style does not.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Monospace ¶ added in v0.4.0
type Monospace uint8
Monospace is a set of the parts of diagrams that are set in the monospace face, as Pele's monospace option lists them. A part the author gives a font of its own keeps it.
const ( // Members are the attributes and methods of a class diagram's classes ("members"). Members Monospace = 1 << iota // Attributes are the types, names and keys of the attributes of an entity relationship // diagram's entities ("attributes"). Their comments keep the regular face. Attributes // Files are the names of a tree view's entries ("files"). Files // Messages are the text of a sequence diagram's messages ("messages"). Messages )
type Options ¶
type Options struct {
Measurer text.Measurer // nil is text.Arial
FontSize float64 // of text with no size of its own; 0 is 16
// Icons reports whether the host can draw an icon by name; labels leave room for those
// it can.
Icons func(name string) bool
// MaxWidth is the width the host has for the diagram; a diagram that can draw itself
// narrower does. 0 is no limit.
MaxWidth float64
// KeepDirection keeps a diagram that runs across from being laid out running down when it
// does not fit MaxWidth; it is, by default, when MaxWidth is under DirectionBreakpoint
// (0 is 640) and running down is narrower.
KeepDirection bool
DirectionBreakpoint float64
// NoLinks and NoImages leave out the links and the images a diagram's text asks for.
// LinkSchemes and ImageSchemes are the schemes they may use besides a relative address:
// nil is http, https, mailto and tel for links, and http and https for images.
NoLinks, NoImages bool
LinkSchemes, ImageSchemes []string
// Padding is the room about a diagram, Pele's padding option: nil is Pele's 8, and a
// pointer to 0 is none. Set it with new(12.0). A host that wants no room about some
// diagram and the default about others tells them apart this way, since 0 is a padding.
Padding *float64
// Snap rounds where things are to whole multiples of it, for a backend that draws on a
// grid of pixels. 0 leaves them as they fall. limu.Layout and Diagram.Layout snap the
// scene; a diagram package's own Layout leaves it to its caller, who snaps the scene
// with Scene.Snap.
Snap float64
// Routing is how edges run, in the diagrams laid out in ranks.
Routing Routing
// Monospace is the parts of diagrams set in the monospace face, Pele's monospace option.
// They are measured in it, so it changes where things are.
Monospace Monospace
// Now is the time a diagram that places things in time takes as the present: where a
// gantt chart draws today, and where a task with no start begins. The zero time is
// time.Now().
Now time.Time
// Location is the time zone such a diagram reads and writes dates in, as JavaScript
// does in the machine's: the days that tasks start on, the ticks of its axis. nil is
// time.Local.
Location *time.Location
}
Options are what a layout takes besides the diagram.
type Routing ¶
type Routing uint8
Routing is how edges run between the things they join. It is a setting of the diagrams on the layered layout: flowcharts, swimlane, agent flow, state, class, ER, requirement and use case diagrams. Auto leaves them to the text's curve, or to the curve Pele draws where the text has none, and Orthogonal and Straight take the place of the step and linear curves. The other diagrams route their edges as Pele does and pay it no heed.