Documentation
¶
Overview ¶
Package synth builds a synthetic UI-mockup / diagram document for gfx benchmarks: rounded boxes with border, shadow and two text lines, joined by cubic connectors with arrowheads, every third one dashed.
Index ¶
Examples ¶
Constants ¶
const ( ScreenW = 1920.0 ScreenH = 1080.0 // Gap between neighbouring screens on the grid. ScreenGap = 160.0 )
Mock screens: 1920 x 1080 application windows made of an app rail, a sidebar of icon and label rows, a header with tabs, and a body that is a form, a list of rows or a board of cards, with text on nearly every node. The node counts match what the real design screens of a task tracker give (about 150 to 540 nodes and 40 to 150 text lines per screen, a third of the nodes vector icons); the colors and strings are made up.
const ( CellW = 200.0 // grid pitch of the box layout CellH = 130.0 )
CellW and CellH are the pitch of the box grid.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Conn ¶
type Conn struct {
Node *gfx.Node
Shape *gfx.Path
A, B *Box
Vert bool // bottom-to-top instead of right-to-left
Dashed bool
}
Conn is a connector node between two boxes.
type Doc ¶
Doc is a synthetic document: boxes on a grid and the connectors added with Link.
func New ¶
New lays out n boxes in a wide grid with right and down connectors.
Example ¶
A document of boxes on a grid for benchmarks and demos; Link adds a connector between two boxes.
package main
import (
"fmt"
"github.com/haiodo/gowt/gfx/synth"
)
func main() {
doc := synth.New(100, 1)
n := len(doc.Conns) // New already links neighbours
doc.Link(doc.Boxes[0], doc.Boxes[5], false)
doc.Scene.Commit()
fmt.Println(len(doc.Boxes), len(doc.Conns)-n)
}
Output: 100 1