package shape
Import Path
oss.terrastruct.com/d2/lib/shape (on go.dev)
Dependency Relation
imports 4 packages, and imported by 6 packages
Involved Source Files
shape.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
Package-Level Type Names (only one)
( Shape) AspectRatio1() bool
( Shape) GetBox() *geo.Box
( Shape) GetDefaultPadding() (paddingX, paddingY float64)
( Shape) GetDimensionsToFit(width, height, paddingX, paddingY float64) (float64, float64)
( Shape) GetInnerBox() *geo.Box
cloud shape has different innerBoxes depending on content's aspect ratio
placing a rectangle of the given size and padding inside the shape, return the position relative to the shape's TopLeft
( Shape) GetSVGPathData() []string
( Shape) GetType() string
( Shape) Is(shape string) bool
( Shape) IsRectangular() bool
Perimeter returns a slice of geo.Intersectables that together constitute the shape border
( Shape) SetInnerBoxAspectRatio(aspectRatio float64)
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
func oss.terrastruct.com/d2/d2graph.(*Object).ToShape() Shape
func TraceToShapeBorder(shape Shape, rectBorderPoint, prevPoint *geo.Point) *geo.Point
Package-Level Functions (total 25)
func NewCallout(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 NewPackage(box *geo.Box) Shape func NewParallelogram(box *geo.Box) Shape func NewRealSquare(box *geo.Box) Shape func NewStoredData(box *geo.Box) Shape
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──────────┘
Package-Level Constants (total 39)
const CALLOUT_TYPE = "Callout" const CIRCLE_TYPE = "Circle" const CLASS_TYPE = "Class" const CLOUD_SQUARE_INNER_HEIGHT = 0.663 const CLOUD_SQUARE_INNER_WIDTH = 0.663
The percentage values of the cloud's square inner box
const CLOUD_SQUARE_INNER_Y = 0.335 const CLOUD_TALL_ASPECT_BOUNDARY = 0.834756 const CLOUD_TALL_INNER_HEIGHT = 0.82 const CLOUD_TALL_INNER_WIDTH = 0.549
The percentage values of the cloud's tall inner box
const CLOUD_TALL_INNER_Y = 0.179 const CLOUD_TYPE = "Cloud" const CLOUD_WIDE_ASPECT_BOUNDARY = 1.24726 const CLOUD_WIDE_INNER_HEIGHT = 0.548 const CLOUD_WIDE_INNER_WIDTH = 0.819
The percentage values of the cloud's wide inner box
const CLOUD_WIDE_INNER_Y = 0.409 const CODE_TYPE = "Code" const CYLINDER_TYPE = "Cylinder" const DIAMOND_TYPE = "Diamond" const DOCUMENT_TYPE = "Document" const HEXAGON_TYPE = "Hexagon" const IMAGE_TYPE = "Image" const OVAL_AR_LIMIT = 3 const OVAL_TYPE = "Oval" const PACKAGE_TYPE = "Package" const PAGE_TYPE = "Page" const PARALLELOGRAM_TYPE = "Parallelogram" const PERSON_AR_LIMIT = 1.5 const PERSON_TYPE = "Person" const QUEUE_TYPE = "Queue" const REAL_SQUARE_TYPE = "RealSquare" const SQUARE_TYPE = "Square" const STEP_TYPE = "Step" const STEP_WEDGE_WIDTH = 35 const STORED_DATA_TYPE = "StoredData" const TABLE_TYPE = "Table" const TEXT_TYPE = "Text"![]() |
The pages are generated with Golds v0.8.2. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |