Documentation
¶
Index ¶
- Constants
- func FitC4PersonBody(width, height, contentHeight float64) (float64, float64)
- func GetPathCommands(s Shape) [][]svg.PathCommand
- func GridContentBox(s Shape) *geo.Box
- func GridDimensionsToFit(s Shape, width, height, paddingX, paddingY float64) (float64, float64)
- func LimitAR(width, height, aspectRatio float64) (float64, float64)
- func ReserveGridPadding(shapeType string, contentHeight float64, padding *geo.Spacing)
- func StepWedgeWidth(width float64) float64
- func TraceToShapeBorder(shape Shape, rectBorderPoint, prevPoint *geo.Point) *geo.Point
- type PathCommandProvider
- type Shape
- func NewC4Person(box *geo.Box) Shape
- func NewCallout(box *geo.Box) Shape
- func NewCircle(box *geo.Box) Shape
- func NewClass(box *geo.Box) Shape
- func NewCloud(box *geo.Box) Shape
- func NewCode(box *geo.Box) Shape
- func NewCylinder(box *geo.Box) Shape
- func NewDiamond(box *geo.Box) Shape
- func NewDocument(box *geo.Box) Shape
- func NewHexagon(box *geo.Box) Shape
- func NewImage(box *geo.Box) Shape
- func NewOval(box *geo.Box) Shape
- func NewPackage(box *geo.Box) Shape
- func NewPage(box *geo.Box) Shape
- func NewParallelogram(box *geo.Box) Shape
- func NewPerson(box *geo.Box) Shape
- func NewQueue(box *geo.Box) Shape
- func NewRealSquare(box *geo.Box) Shape
- func NewShape(shapeType string, box *geo.Box) Shape
- func NewSquare(box *geo.Box) Shape
- func NewStep(box *geo.Box) Shape
- func NewStoredData(box *geo.Box) Shape
- func NewTable(box *geo.Box) Shape
- func NewText(box *geo.Box) Shape
Constants ¶
const ( SQUARE_TYPE = "Square" REAL_SQUARE_TYPE = "RealSquare" PARALLELOGRAM_TYPE = "Parallelogram" DOCUMENT_TYPE = "Document" CYLINDER_TYPE = "Cylinder" QUEUE_TYPE = "Queue" PAGE_TYPE = "Page" PACKAGE_TYPE = "Package" STEP_TYPE = "Step" CALLOUT_TYPE = "Callout" STORED_DATA_TYPE = "StoredData" PERSON_TYPE = "Person" C4_PERSON_TYPE = "C4Person" DIAMOND_TYPE = "Diamond" OVAL_TYPE = "Oval" CIRCLE_TYPE = "Circle" HEXAGON_TYPE = "Hexagon" CLOUD_TYPE = "Cloud" TABLE_TYPE = "Table" CLASS_TYPE = "Class" TEXT_TYPE = "Text" CODE_TYPE = "Code" IMAGE_TYPE = "Image" )
const ( C4_PERSON_AR_LIMIT = 1.5 HEAD_RADIUS_FACTOR = 0.22 BODY_TOP_FACTOR = 0.8 CORNER_RADIUS_FACTOR = 0.175 )
Constants to match frontend implementation
const CLOUD_SQUARE_INNER_HEIGHT = 0.663
const CLOUD_SQUARE_INNER_WIDTH = 0.663
const CLOUD_SQUARE_INNER_X = 0.167
The percentage values of the cloud's square inner box
const CLOUD_SQUARE_INNER_Y = 0.335
const CLOUD_TALL_ASPECT_BOUNDARY = (1 + CLOUD_TALL_INNER_WIDTH/CLOUD_TALL_INNER_HEIGHT) / 2
const CLOUD_TALL_INNER_HEIGHT = 0.820
const CLOUD_TALL_INNER_WIDTH = 0.549
const CLOUD_TALL_INNER_X = 0.228
The percentage values of the cloud's tall inner box
const CLOUD_TALL_INNER_Y = 0.179
const CLOUD_WIDE_ASPECT_BOUNDARY = (1 + CLOUD_WIDE_INNER_WIDTH/CLOUD_WIDE_INNER_HEIGHT) / 2
const CLOUD_WIDE_INNER_HEIGHT = 0.548
const CLOUD_WIDE_INNER_WIDTH = 0.819
const CLOUD_WIDE_INNER_X = 0.085
The percentage values of the cloud's wide inner box
const CLOUD_WIDE_INNER_Y = 0.409
const OVAL_AR_LIMIT = 3.
const (
PERSON_AR_LIMIT = 1.5
)
const STEP_WEDGE_WIDTH = 35.0
Variables ¶
This section is empty.
Functions ¶
func FitC4PersonBody ¶ added in v0.10.0
FitC4PersonBody enlarges a grid container to keep its content below the head after applying authored minimum dimensions. The available body height is (1 - 2*padding)*height - headFraction*width.
func GetPathCommands ¶ added in v0.9.0
func GetPathCommands(s Shape) [][]svg.PathCommand
GetPathCommands returns a shape's absolute custom path commands, or nil when the shape is represented by another primitive such as a rectangle or oval.
func GridContentBox ¶ added in v0.10.0
GridContentBox is the rectangle available for a grid and its padding. A cell with grid-gap: 0 can occupy the entire content rectangle.
func GridDimensionsToFit ¶ added in v0.10.0
GridDimensionsToFit reserves the same interior used to position children.
func ReserveGridPadding ¶ added in v0.10.0
ReserveGridPadding accounts for corners on shapes where labels normally supply their own padding. Explicit small grid gaps can expose these corners.
func StepWedgeWidth ¶ added in v0.10.0
StepWedgeWidth returns the depth of the two chevrons for a step of this width.
func TraceToShapeBorder ¶
TraceToShapeBorder takes the point on the rectangular border r here is the point on rectangular border p is the prev point (used to calculate slope) s is the point on the actual shape border that'll be returned
. p . │ . │ . ▼ . ┌────r─────────────────────────┐ . │ │ . │ │ │ . │ │ xxxxxxxx │ . │ ▼ xxxxx xxxx │ . │ sxxx xx │ . │ x xx │ . │ xx xx │ . │ x xx │ . │ xx xxx │ . │ xxxx xxxx │ . └──────xxxxxxxxxxxxxx──────────┘
Types ¶
type PathCommandProvider ¶ added in v0.9.0
type PathCommandProvider interface {
GetPathCommands() [][]svg.PathCommand
}
PathCommandProvider is implemented by shapes with custom path geometry. Implementations return a defensive copy of each path's absolute commands. It is separate from Shape so adding typed path access does not break external implementations of Shape.
type Shape ¶
type Shape interface {
Is(shape string) bool
GetType() string
AspectRatio1() bool
IsRectangular() bool
GetBox() *geo.Box
GetInnerBox() *geo.Box
// cloud shape has different innerBoxes depending on content's aspect ratio
GetInnerBoxForContent(width, height float64) *geo.Box
SetInnerBoxAspectRatio(aspectRatio float64)
// placing a rectangle of the given size and padding inside the shape, return the position relative to the shape's TopLeft
GetInsidePlacement(width, height, paddingX, paddingY float64) geo.Point
GetDimensionsToFit(width, height, paddingX, paddingY float64) (float64, float64)
GetDefaultPadding() (paddingX, paddingY float64)
// Perimeter returns a slice of geo.Intersectables that together constitute the shape border
Perimeter() []geo.Intersectable
GetSVGPathData() []string
}
func NewC4Person ¶
func NewCallout ¶
func NewCylinder ¶
func NewDiamond ¶
func NewDocument ¶
func NewHexagon ¶
func NewPackage ¶
func NewParallelogram ¶
func NewRealSquare ¶
func NewStoredData ¶
Source Files
¶
- grid.go
- outline.go
- shape.go
- shape_c4_person.go
- shape_callout.go
- shape_circle.go
- shape_class.go
- shape_cloud.go
- shape_code.go
- shape_cylinder.go
- shape_diamond.go
- shape_document.go
- shape_hexagon.go
- shape_image.go
- shape_oval.go
- shape_package.go
- shape_page.go
- shape_parallelogram.go
- shape_person.go
- shape_queue.go
- shape_real_square.go
- shape_square.go
- shape_step.go
- shape_stored_data.go
- shape_table.go
- shape_text.go