constant nears
This commit is contained in:
parent
0adec7fea2
commit
c32bfdda34
9 changed files with 2690 additions and 2 deletions
|
|
@ -1189,6 +1189,8 @@ var StyleKeywords = map[string]struct{}{
|
|||
"filled": {},
|
||||
}
|
||||
|
||||
// TODO maybe autofmt should allow other values, and transform them to conform
|
||||
// e.g. left-center becomes center-left
|
||||
var NearConstants = map[string]struct{}{
|
||||
"top-left": {},
|
||||
"top-center": {},
|
||||
|
|
|
|||
147
d2layouts/d2near/layout.go
Normal file
147
d2layouts/d2near/layout.go
Normal file
|
|
@ -0,0 +1,147 @@
|
|||
// d2near applies near keywords when they're constants
|
||||
// Intended to be run as the last stage of layout after the diagram has already undergone layout
|
||||
package d2near
|
||||
|
||||
import (
|
||||
"context"
|
||||
"math"
|
||||
"strings"
|
||||
|
||||
"oss.terrastruct.com/d2/d2graph"
|
||||
"oss.terrastruct.com/d2/d2target"
|
||||
"oss.terrastruct.com/d2/lib/geo"
|
||||
"oss.terrastruct.com/d2/lib/label"
|
||||
"oss.terrastruct.com/util-go/go2"
|
||||
)
|
||||
|
||||
const pad = 20
|
||||
|
||||
// Layout finds the shapes which are assigned constant near keywords and places them.
|
||||
func Layout(ctx context.Context, g *d2graph.Graph, constantNears []*d2graph.Object) error {
|
||||
if len(constantNears) == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Imagine the grpah has two long texts, one at top center and one at top left.
|
||||
// Top left should go left enough to not collide with center.
|
||||
// So place the center ones first, then the later ones will consider them for bounding box
|
||||
for _, obj := range constantNears {
|
||||
if strings.Contains(d2graph.Key(obj.Attributes.NearKey)[0], "center") {
|
||||
obj.TopLeft = geo.NewPoint(place(obj))
|
||||
}
|
||||
}
|
||||
for _, obj := range constantNears {
|
||||
if strings.Contains(d2graph.Key(obj.Attributes.NearKey)[0], "center") {
|
||||
// The z-index for constant nears does not matter, as it will not collide
|
||||
g.Objects = append(g.Objects, obj)
|
||||
}
|
||||
}
|
||||
|
||||
for _, obj := range constantNears {
|
||||
if !strings.Contains(d2graph.Key(obj.Attributes.NearKey)[0], "center") {
|
||||
obj.TopLeft = geo.NewPoint(place(obj))
|
||||
}
|
||||
}
|
||||
for _, obj := range constantNears {
|
||||
if !strings.Contains(d2graph.Key(obj.Attributes.NearKey)[0], "center") {
|
||||
// The z-index for constant nears does not matter, as it will not collide
|
||||
g.Objects = append(g.Objects, obj)
|
||||
}
|
||||
}
|
||||
|
||||
// These shapes skipped core layout, which means they also skipped label placements
|
||||
for _, obj := range constantNears {
|
||||
if obj.Attributes.Shape.Value == d2target.ShapeImage {
|
||||
obj.LabelPosition = go2.Pointer(string(label.OutsideBottomCenter))
|
||||
} else if obj.Attributes.Icon != nil {
|
||||
obj.LabelPosition = go2.Pointer(string(label.InsideTopCenter))
|
||||
} else {
|
||||
obj.LabelPosition = go2.Pointer(string(label.InsideMiddleCenter))
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// position returns the position of obj, taking into consideration its near value and the diagram
|
||||
func place(obj *d2graph.Object) (float64, float64) {
|
||||
tl, br := boundingBox(obj.Graph)
|
||||
w := br.X - tl.X
|
||||
h := br.Y - tl.Y
|
||||
switch d2graph.Key(obj.Attributes.NearKey)[0] {
|
||||
case "top-left":
|
||||
return tl.X - obj.Width - pad, tl.Y - obj.Height - pad
|
||||
case "top-center":
|
||||
return tl.X + w/2 - obj.Width/2, tl.Y - obj.Height - pad
|
||||
case "top-right":
|
||||
return br.X + pad, tl.Y - obj.Height - pad
|
||||
case "center-left":
|
||||
return tl.X - obj.Width - pad, tl.Y + h/2 - obj.Height/2
|
||||
case "center-right":
|
||||
return br.X + pad, tl.Y + h/2 - obj.Height/2
|
||||
case "bottom-left":
|
||||
return tl.X - obj.Width - pad, br.Y + pad
|
||||
case "bottom-center":
|
||||
return br.X - w/2 - obj.Width/2, br.Y + pad
|
||||
case "bottom-right":
|
||||
return br.X + pad, br.Y + pad
|
||||
}
|
||||
return 0, 0
|
||||
|
||||
}
|
||||
|
||||
// WithoutConstantNears removes
|
||||
func WithoutConstantNears(ctx context.Context, g *d2graph.Graph) (nears []*d2graph.Object) {
|
||||
for i := 0; i < len(g.Objects); i++ {
|
||||
obj := g.Objects[i]
|
||||
if obj.Attributes.NearKey == nil {
|
||||
continue
|
||||
}
|
||||
_, isKey := g.Root.HasChild(d2graph.Key(obj.Attributes.NearKey))
|
||||
if isKey {
|
||||
continue
|
||||
}
|
||||
_, isConst := d2graph.NearConstants[d2graph.Key(obj.Attributes.NearKey)[0]]
|
||||
if isConst {
|
||||
nears = append(nears, obj)
|
||||
g.Objects = append(g.Objects[:i], g.Objects[i+1:]...)
|
||||
i--
|
||||
}
|
||||
}
|
||||
return nears
|
||||
}
|
||||
|
||||
// boundingBox gets the center of the graph as defined by shapes
|
||||
// The bounds taking into consideration only shapes gives more of a feeling of true center
|
||||
// It differs from d2target.BoundingBox which needs to include every visible thing
|
||||
func boundingBox(g *d2graph.Graph) (tl, br *geo.Point) {
|
||||
if len(g.Objects) == 0 {
|
||||
return geo.NewPoint(0, 0), geo.NewPoint(0, 0)
|
||||
}
|
||||
x1 := math.Inf(1)
|
||||
y1 := math.Inf(1)
|
||||
x2 := math.Inf(-1)
|
||||
y2 := math.Inf(-1)
|
||||
|
||||
for _, obj := range g.Objects {
|
||||
if obj.Attributes.NearKey != nil {
|
||||
// Top left should not be MORE top than top-center
|
||||
// But it should go more left if top-center label extends beyond bounds of diagram
|
||||
switch d2graph.Key(obj.Attributes.NearKey)[0] {
|
||||
case "top-center", "bottom-center":
|
||||
x1 = math.Min(x1, obj.TopLeft.X)
|
||||
x2 = math.Max(x2, obj.TopLeft.X+obj.Width)
|
||||
case "center-left", "center-right":
|
||||
y1 = math.Min(y1, obj.TopLeft.Y)
|
||||
y2 = math.Max(y2, obj.TopLeft.Y+obj.Height)
|
||||
}
|
||||
} else {
|
||||
x1 = math.Min(x1, obj.TopLeft.X)
|
||||
y1 = math.Min(y1, obj.TopLeft.Y)
|
||||
x2 = math.Max(x2, obj.TopLeft.X+obj.Width)
|
||||
y2 = math.Max(y2, obj.TopLeft.Y+obj.Height)
|
||||
}
|
||||
}
|
||||
|
||||
return geo.NewPoint(x1, y1), geo.NewPoint(x2, y2)
|
||||
}
|
||||
|
|
@ -69,6 +69,7 @@ func Layout(ctx context.Context, g *d2graph.Graph, layout func(ctx context.Conte
|
|||
layoutEdges, edgeOrder := getLayoutEdges(g, edgesToRemove)
|
||||
g.Edges = layoutEdges
|
||||
layoutObjects, objectOrder := getLayoutObjects(g, objectsToRemove)
|
||||
// TODO this isn't a proper deletion because the objects still appear as children of the object
|
||||
g.Objects = layoutObjects
|
||||
|
||||
if g.Root.IsSequenceDiagram() {
|
||||
|
|
|
|||
16
d2lib/d2.go
16
d2lib/d2.go
|
|
@ -9,6 +9,7 @@ import (
|
|||
"oss.terrastruct.com/d2/d2compiler"
|
||||
"oss.terrastruct.com/d2/d2exporter"
|
||||
"oss.terrastruct.com/d2/d2graph"
|
||||
"oss.terrastruct.com/d2/d2layouts/d2near"
|
||||
"oss.terrastruct.com/d2/d2layouts/d2sequence"
|
||||
"oss.terrastruct.com/d2/d2renderers/d2fonts"
|
||||
"oss.terrastruct.com/d2/d2target"
|
||||
|
|
@ -48,9 +49,20 @@ func Compile(ctx context.Context, input string, opts *CompileOptions) (*d2target
|
|||
return nil, nil, err
|
||||
}
|
||||
|
||||
if layout, err := getLayout(opts); err != nil {
|
||||
coreLayout, err := getLayout(opts)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
} else if err := d2sequence.Layout(ctx, g, layout); err != nil {
|
||||
}
|
||||
|
||||
constantNears := d2near.WithoutConstantNears(ctx, g)
|
||||
|
||||
err = d2sequence.Layout(ctx, g, coreLayout)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
err = d2near.Layout(ctx, g, constantNears)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1585,6 +1585,25 @@ container: {
|
|||
label: to right container root
|
||||
}
|
||||
}
|
||||
`,
|
||||
},
|
||||
{
|
||||
name: "constant_near",
|
||||
script: `x -> y
|
||||
The top of the mountain: { shape: text; near: top-center }
|
||||
Joe: { shape: person; near: center-left }
|
||||
Donald: { shape: person; near: center-right }
|
||||
bottom: |md
|
||||
# Cats, no less liquid than their shadows, offer no angles to the wind.
|
||||
|
||||
If we can't fix it, it ain't broke.
|
||||
|
||||
Dieters live life in the fasting lane.
|
||||
| { near: bottom-center }
|
||||
i am top left: { shape: text; near: top-left }
|
||||
i am top right: { shape: text; near: top-right }
|
||||
i am bottom left: { shape: text; near: bottom-left }
|
||||
i am bottom right: { shape: text; near: bottom-right }
|
||||
`,
|
||||
},
|
||||
}
|
||||
|
|
|
|||
456
e2etests/testdata/stable/constant_near/dagre/board.exp.json
generated
vendored
Normal file
456
e2etests/testdata/stable/constant_near/dagre/board.exp.json
generated
vendored
Normal file
|
|
@ -0,0 +1,456 @@
|
|||
{
|
||||
"name": "",
|
||||
"fontFamily": "SourceSansPro",
|
||||
"shapes": [
|
||||
{
|
||||
"id": "x",
|
||||
"type": "",
|
||||
"pos": {
|
||||
"x": 1,
|
||||
"y": 0
|
||||
},
|
||||
"width": 113,
|
||||
"height": 126,
|
||||
"opacity": 1,
|
||||
"strokeDash": 0,
|
||||
"strokeWidth": 2,
|
||||
"borderRadius": 0,
|
||||
"fill": "#F7F8FE",
|
||||
"stroke": "#0D32B2",
|
||||
"shadow": false,
|
||||
"3d": false,
|
||||
"multiple": false,
|
||||
"tooltip": "",
|
||||
"link": "",
|
||||
"icon": null,
|
||||
"iconPosition": "",
|
||||
"blend": false,
|
||||
"fields": null,
|
||||
"methods": null,
|
||||
"columns": null,
|
||||
"label": "x",
|
||||
"fontSize": 16,
|
||||
"fontFamily": "DEFAULT",
|
||||
"language": "",
|
||||
"color": "#0A0F25",
|
||||
"italic": false,
|
||||
"bold": true,
|
||||
"underline": false,
|
||||
"labelWidth": 13,
|
||||
"labelHeight": 26,
|
||||
"labelPosition": "INSIDE_MIDDLE_CENTER",
|
||||
"zIndex": 0,
|
||||
"level": 1
|
||||
},
|
||||
{
|
||||
"id": "y",
|
||||
"type": "",
|
||||
"pos": {
|
||||
"x": 0,
|
||||
"y": 226
|
||||
},
|
||||
"width": 114,
|
||||
"height": 126,
|
||||
"opacity": 1,
|
||||
"strokeDash": 0,
|
||||
"strokeWidth": 2,
|
||||
"borderRadius": 0,
|
||||
"fill": "#F7F8FE",
|
||||
"stroke": "#0D32B2",
|
||||
"shadow": false,
|
||||
"3d": false,
|
||||
"multiple": false,
|
||||
"tooltip": "",
|
||||
"link": "",
|
||||
"icon": null,
|
||||
"iconPosition": "",
|
||||
"blend": false,
|
||||
"fields": null,
|
||||
"methods": null,
|
||||
"columns": null,
|
||||
"label": "y",
|
||||
"fontSize": 16,
|
||||
"fontFamily": "DEFAULT",
|
||||
"language": "",
|
||||
"color": "#0A0F25",
|
||||
"italic": false,
|
||||
"bold": true,
|
||||
"underline": false,
|
||||
"labelWidth": 14,
|
||||
"labelHeight": 26,
|
||||
"labelPosition": "INSIDE_MIDDLE_CENTER",
|
||||
"zIndex": 0,
|
||||
"level": 1
|
||||
},
|
||||
{
|
||||
"id": "The top of the mountain",
|
||||
"type": "text",
|
||||
"pos": {
|
||||
"x": -24,
|
||||
"y": -44
|
||||
},
|
||||
"width": 162,
|
||||
"height": 24,
|
||||
"opacity": 1,
|
||||
"strokeDash": 0,
|
||||
"strokeWidth": 2,
|
||||
"borderRadius": 0,
|
||||
"fill": "transparent",
|
||||
"stroke": "#0A0F25",
|
||||
"shadow": false,
|
||||
"3d": false,
|
||||
"multiple": false,
|
||||
"tooltip": "",
|
||||
"link": "",
|
||||
"icon": null,
|
||||
"iconPosition": "",
|
||||
"blend": false,
|
||||
"fields": null,
|
||||
"methods": null,
|
||||
"columns": null,
|
||||
"label": "The top of the mountain",
|
||||
"fontSize": 16,
|
||||
"fontFamily": "DEFAULT",
|
||||
"language": "",
|
||||
"color": "#0A0F25",
|
||||
"italic": false,
|
||||
"bold": true,
|
||||
"underline": false,
|
||||
"labelWidth": 162,
|
||||
"labelHeight": 24,
|
||||
"labelPosition": "INSIDE_MIDDLE_CENTER",
|
||||
"zIndex": 0,
|
||||
"level": 1
|
||||
},
|
||||
{
|
||||
"id": "Joe",
|
||||
"type": "person",
|
||||
"pos": {
|
||||
"x": -151,
|
||||
"y": 113
|
||||
},
|
||||
"width": 131,
|
||||
"height": 126,
|
||||
"opacity": 1,
|
||||
"strokeDash": 0,
|
||||
"strokeWidth": 2,
|
||||
"borderRadius": 0,
|
||||
"fill": "#E3E9FD",
|
||||
"stroke": "#0D32B2",
|
||||
"shadow": false,
|
||||
"3d": false,
|
||||
"multiple": false,
|
||||
"tooltip": "",
|
||||
"link": "",
|
||||
"icon": null,
|
||||
"iconPosition": "",
|
||||
"blend": false,
|
||||
"fields": null,
|
||||
"methods": null,
|
||||
"columns": null,
|
||||
"label": "Joe",
|
||||
"fontSize": 16,
|
||||
"fontFamily": "DEFAULT",
|
||||
"language": "",
|
||||
"color": "#0A0F25",
|
||||
"italic": false,
|
||||
"bold": true,
|
||||
"underline": false,
|
||||
"labelWidth": 31,
|
||||
"labelHeight": 26,
|
||||
"labelPosition": "INSIDE_MIDDLE_CENTER",
|
||||
"zIndex": 0,
|
||||
"level": 1
|
||||
},
|
||||
{
|
||||
"id": "Donald",
|
||||
"type": "person",
|
||||
"pos": {
|
||||
"x": 134,
|
||||
"y": 113
|
||||
},
|
||||
"width": 155,
|
||||
"height": 126,
|
||||
"opacity": 1,
|
||||
"strokeDash": 0,
|
||||
"strokeWidth": 2,
|
||||
"borderRadius": 0,
|
||||
"fill": "#E3E9FD",
|
||||
"stroke": "#0D32B2",
|
||||
"shadow": false,
|
||||
"3d": false,
|
||||
"multiple": false,
|
||||
"tooltip": "",
|
||||
"link": "",
|
||||
"icon": null,
|
||||
"iconPosition": "",
|
||||
"blend": false,
|
||||
"fields": null,
|
||||
"methods": null,
|
||||
"columns": null,
|
||||
"label": "Donald",
|
||||
"fontSize": 16,
|
||||
"fontFamily": "DEFAULT",
|
||||
"language": "",
|
||||
"color": "#0A0F25",
|
||||
"italic": false,
|
||||
"bold": true,
|
||||
"underline": false,
|
||||
"labelWidth": 55,
|
||||
"labelHeight": 26,
|
||||
"labelPosition": "INSIDE_MIDDLE_CENTER",
|
||||
"zIndex": 0,
|
||||
"level": 1
|
||||
},
|
||||
{
|
||||
"id": "bottom",
|
||||
"type": "text",
|
||||
"pos": {
|
||||
"x": -414,
|
||||
"y": 372
|
||||
},
|
||||
"width": 943,
|
||||
"height": 130,
|
||||
"opacity": 1,
|
||||
"strokeDash": 0,
|
||||
"strokeWidth": 2,
|
||||
"borderRadius": 0,
|
||||
"fill": "transparent",
|
||||
"stroke": "#0A0F25",
|
||||
"shadow": false,
|
||||
"3d": false,
|
||||
"multiple": false,
|
||||
"tooltip": "",
|
||||
"link": "",
|
||||
"icon": null,
|
||||
"iconPosition": "",
|
||||
"blend": false,
|
||||
"fields": null,
|
||||
"methods": null,
|
||||
"columns": null,
|
||||
"label": "# Cats, no less liquid than their shadows, offer no angles to the wind.\n\nIf we can't fix it, it ain't broke.\n\nDieters live life in the fasting lane.",
|
||||
"fontSize": 16,
|
||||
"fontFamily": "DEFAULT",
|
||||
"language": "markdown",
|
||||
"color": "#0A0F25",
|
||||
"italic": false,
|
||||
"bold": true,
|
||||
"underline": false,
|
||||
"labelWidth": 943,
|
||||
"labelHeight": 130,
|
||||
"labelPosition": "INSIDE_MIDDLE_CENTER",
|
||||
"zIndex": 0,
|
||||
"level": 1
|
||||
},
|
||||
{
|
||||
"id": "i am top left",
|
||||
"type": "text",
|
||||
"pos": {
|
||||
"x": -515,
|
||||
"y": -44
|
||||
},
|
||||
"width": 81,
|
||||
"height": 24,
|
||||
"opacity": 1,
|
||||
"strokeDash": 0,
|
||||
"strokeWidth": 2,
|
||||
"borderRadius": 0,
|
||||
"fill": "transparent",
|
||||
"stroke": "#0A0F25",
|
||||
"shadow": false,
|
||||
"3d": false,
|
||||
"multiple": false,
|
||||
"tooltip": "",
|
||||
"link": "",
|
||||
"icon": null,
|
||||
"iconPosition": "",
|
||||
"blend": false,
|
||||
"fields": null,
|
||||
"methods": null,
|
||||
"columns": null,
|
||||
"label": "i am top left",
|
||||
"fontSize": 16,
|
||||
"fontFamily": "DEFAULT",
|
||||
"language": "",
|
||||
"color": "#0A0F25",
|
||||
"italic": false,
|
||||
"bold": true,
|
||||
"underline": false,
|
||||
"labelWidth": 81,
|
||||
"labelHeight": 24,
|
||||
"labelPosition": "INSIDE_MIDDLE_CENTER",
|
||||
"zIndex": 0,
|
||||
"level": 1
|
||||
},
|
||||
{
|
||||
"id": "i am top right",
|
||||
"type": "text",
|
||||
"pos": {
|
||||
"x": 548,
|
||||
"y": -44
|
||||
},
|
||||
"width": 91,
|
||||
"height": 24,
|
||||
"opacity": 1,
|
||||
"strokeDash": 0,
|
||||
"strokeWidth": 2,
|
||||
"borderRadius": 0,
|
||||
"fill": "transparent",
|
||||
"stroke": "#0A0F25",
|
||||
"shadow": false,
|
||||
"3d": false,
|
||||
"multiple": false,
|
||||
"tooltip": "",
|
||||
"link": "",
|
||||
"icon": null,
|
||||
"iconPosition": "",
|
||||
"blend": false,
|
||||
"fields": null,
|
||||
"methods": null,
|
||||
"columns": null,
|
||||
"label": "i am top right",
|
||||
"fontSize": 16,
|
||||
"fontFamily": "DEFAULT",
|
||||
"language": "",
|
||||
"color": "#0A0F25",
|
||||
"italic": false,
|
||||
"bold": true,
|
||||
"underline": false,
|
||||
"labelWidth": 91,
|
||||
"labelHeight": 24,
|
||||
"labelPosition": "INSIDE_MIDDLE_CENTER",
|
||||
"zIndex": 0,
|
||||
"level": 1
|
||||
},
|
||||
{
|
||||
"id": "i am bottom left",
|
||||
"type": "text",
|
||||
"pos": {
|
||||
"x": -542,
|
||||
"y": 372
|
||||
},
|
||||
"width": 108,
|
||||
"height": 24,
|
||||
"opacity": 1,
|
||||
"strokeDash": 0,
|
||||
"strokeWidth": 2,
|
||||
"borderRadius": 0,
|
||||
"fill": "transparent",
|
||||
"stroke": "#0A0F25",
|
||||
"shadow": false,
|
||||
"3d": false,
|
||||
"multiple": false,
|
||||
"tooltip": "",
|
||||
"link": "",
|
||||
"icon": null,
|
||||
"iconPosition": "",
|
||||
"blend": false,
|
||||
"fields": null,
|
||||
"methods": null,
|
||||
"columns": null,
|
||||
"label": "i am bottom left",
|
||||
"fontSize": 16,
|
||||
"fontFamily": "DEFAULT",
|
||||
"language": "",
|
||||
"color": "#0A0F25",
|
||||
"italic": false,
|
||||
"bold": true,
|
||||
"underline": false,
|
||||
"labelWidth": 108,
|
||||
"labelHeight": 24,
|
||||
"labelPosition": "INSIDE_MIDDLE_CENTER",
|
||||
"zIndex": 0,
|
||||
"level": 1
|
||||
},
|
||||
{
|
||||
"id": "i am bottom right",
|
||||
"type": "text",
|
||||
"pos": {
|
||||
"x": 548,
|
||||
"y": 372
|
||||
},
|
||||
"width": 118,
|
||||
"height": 24,
|
||||
"opacity": 1,
|
||||
"strokeDash": 0,
|
||||
"strokeWidth": 2,
|
||||
"borderRadius": 0,
|
||||
"fill": "transparent",
|
||||
"stroke": "#0A0F25",
|
||||
"shadow": false,
|
||||
"3d": false,
|
||||
"multiple": false,
|
||||
"tooltip": "",
|
||||
"link": "",
|
||||
"icon": null,
|
||||
"iconPosition": "",
|
||||
"blend": false,
|
||||
"fields": null,
|
||||
"methods": null,
|
||||
"columns": null,
|
||||
"label": "i am bottom right",
|
||||
"fontSize": 16,
|
||||
"fontFamily": "DEFAULT",
|
||||
"language": "",
|
||||
"color": "#0A0F25",
|
||||
"italic": false,
|
||||
"bold": true,
|
||||
"underline": false,
|
||||
"labelWidth": 118,
|
||||
"labelHeight": 24,
|
||||
"labelPosition": "INSIDE_MIDDLE_CENTER",
|
||||
"zIndex": 0,
|
||||
"level": 1
|
||||
}
|
||||
],
|
||||
"connections": [
|
||||
{
|
||||
"id": "(x -> y)[0]",
|
||||
"src": "x",
|
||||
"srcArrow": "none",
|
||||
"srcLabel": "",
|
||||
"dst": "y",
|
||||
"dstArrow": "triangle",
|
||||
"dstLabel": "",
|
||||
"opacity": 1,
|
||||
"strokeDash": 0,
|
||||
"strokeWidth": 2,
|
||||
"stroke": "#0D32B2",
|
||||
"label": "",
|
||||
"fontSize": 16,
|
||||
"fontFamily": "DEFAULT",
|
||||
"language": "",
|
||||
"color": "#676C7E",
|
||||
"italic": true,
|
||||
"bold": false,
|
||||
"underline": false,
|
||||
"labelWidth": 0,
|
||||
"labelHeight": 0,
|
||||
"labelPosition": "",
|
||||
"labelPercentage": 0,
|
||||
"route": [
|
||||
{
|
||||
"x": 57,
|
||||
"y": 126
|
||||
},
|
||||
{
|
||||
"x": 57,
|
||||
"y": 166
|
||||
},
|
||||
{
|
||||
"x": 57,
|
||||
"y": 186
|
||||
},
|
||||
{
|
||||
"x": 57,
|
||||
"y": 226
|
||||
}
|
||||
],
|
||||
"isCurve": true,
|
||||
"animated": false,
|
||||
"tooltip": "",
|
||||
"icon": null,
|
||||
"zIndex": 0
|
||||
}
|
||||
]
|
||||
}
|
||||
802
e2etests/testdata/stable/constant_near/dagre/sketch.exp.svg
vendored
Normal file
802
e2etests/testdata/stable/constant_near/dagre/sketch.exp.svg
vendored
Normal file
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 663 KiB |
447
e2etests/testdata/stable/constant_near/elk/board.exp.json
generated
vendored
Normal file
447
e2etests/testdata/stable/constant_near/elk/board.exp.json
generated
vendored
Normal file
|
|
@ -0,0 +1,447 @@
|
|||
{
|
||||
"name": "",
|
||||
"fontFamily": "SourceSansPro",
|
||||
"shapes": [
|
||||
{
|
||||
"id": "x",
|
||||
"type": "",
|
||||
"pos": {
|
||||
"x": 1961,
|
||||
"y": 16
|
||||
},
|
||||
"width": 113,
|
||||
"height": 126,
|
||||
"opacity": 1,
|
||||
"strokeDash": 0,
|
||||
"strokeWidth": 2,
|
||||
"borderRadius": 0,
|
||||
"fill": "#F7F8FE",
|
||||
"stroke": "#0D32B2",
|
||||
"shadow": false,
|
||||
"3d": false,
|
||||
"multiple": false,
|
||||
"tooltip": "",
|
||||
"link": "",
|
||||
"icon": null,
|
||||
"iconPosition": "",
|
||||
"blend": false,
|
||||
"fields": null,
|
||||
"methods": null,
|
||||
"columns": null,
|
||||
"label": "x",
|
||||
"fontSize": 16,
|
||||
"fontFamily": "DEFAULT",
|
||||
"language": "",
|
||||
"color": "#0A0F25",
|
||||
"italic": false,
|
||||
"bold": true,
|
||||
"underline": false,
|
||||
"labelWidth": 13,
|
||||
"labelHeight": 26,
|
||||
"labelPosition": "INSIDE_MIDDLE_CENTER",
|
||||
"zIndex": 0,
|
||||
"level": 1
|
||||
},
|
||||
{
|
||||
"id": "y",
|
||||
"type": "",
|
||||
"pos": {
|
||||
"x": 1960,
|
||||
"y": 242
|
||||
},
|
||||
"width": 114,
|
||||
"height": 126,
|
||||
"opacity": 1,
|
||||
"strokeDash": 0,
|
||||
"strokeWidth": 2,
|
||||
"borderRadius": 0,
|
||||
"fill": "#F7F8FE",
|
||||
"stroke": "#0D32B2",
|
||||
"shadow": false,
|
||||
"3d": false,
|
||||
"multiple": false,
|
||||
"tooltip": "",
|
||||
"link": "",
|
||||
"icon": null,
|
||||
"iconPosition": "",
|
||||
"blend": false,
|
||||
"fields": null,
|
||||
"methods": null,
|
||||
"columns": null,
|
||||
"label": "y",
|
||||
"fontSize": 16,
|
||||
"fontFamily": "DEFAULT",
|
||||
"language": "",
|
||||
"color": "#0A0F25",
|
||||
"italic": false,
|
||||
"bold": true,
|
||||
"underline": false,
|
||||
"labelWidth": 14,
|
||||
"labelHeight": 26,
|
||||
"labelPosition": "INSIDE_MIDDLE_CENTER",
|
||||
"zIndex": 0,
|
||||
"level": 1
|
||||
},
|
||||
{
|
||||
"id": "The top of the mountain",
|
||||
"type": "text",
|
||||
"pos": {
|
||||
"x": 1936,
|
||||
"y": -28
|
||||
},
|
||||
"width": 162,
|
||||
"height": 24,
|
||||
"opacity": 1,
|
||||
"strokeDash": 0,
|
||||
"strokeWidth": 2,
|
||||
"borderRadius": 0,
|
||||
"fill": "transparent",
|
||||
"stroke": "#0A0F25",
|
||||
"shadow": false,
|
||||
"3d": false,
|
||||
"multiple": false,
|
||||
"tooltip": "",
|
||||
"link": "",
|
||||
"icon": null,
|
||||
"iconPosition": "",
|
||||
"blend": false,
|
||||
"fields": null,
|
||||
"methods": null,
|
||||
"columns": null,
|
||||
"label": "The top of the mountain",
|
||||
"fontSize": 16,
|
||||
"fontFamily": "DEFAULT",
|
||||
"language": "",
|
||||
"color": "#0A0F25",
|
||||
"italic": false,
|
||||
"bold": true,
|
||||
"underline": false,
|
||||
"labelWidth": 162,
|
||||
"labelHeight": 24,
|
||||
"labelPosition": "INSIDE_MIDDLE_CENTER",
|
||||
"zIndex": 0,
|
||||
"level": 1
|
||||
},
|
||||
{
|
||||
"id": "Joe",
|
||||
"type": "person",
|
||||
"pos": {
|
||||
"x": 1809,
|
||||
"y": 129
|
||||
},
|
||||
"width": 131,
|
||||
"height": 126,
|
||||
"opacity": 1,
|
||||
"strokeDash": 0,
|
||||
"strokeWidth": 2,
|
||||
"borderRadius": 0,
|
||||
"fill": "#E3E9FD",
|
||||
"stroke": "#0D32B2",
|
||||
"shadow": false,
|
||||
"3d": false,
|
||||
"multiple": false,
|
||||
"tooltip": "",
|
||||
"link": "",
|
||||
"icon": null,
|
||||
"iconPosition": "",
|
||||
"blend": false,
|
||||
"fields": null,
|
||||
"methods": null,
|
||||
"columns": null,
|
||||
"label": "Joe",
|
||||
"fontSize": 16,
|
||||
"fontFamily": "DEFAULT",
|
||||
"language": "",
|
||||
"color": "#0A0F25",
|
||||
"italic": false,
|
||||
"bold": true,
|
||||
"underline": false,
|
||||
"labelWidth": 31,
|
||||
"labelHeight": 26,
|
||||
"labelPosition": "INSIDE_MIDDLE_CENTER",
|
||||
"zIndex": 0,
|
||||
"level": 1
|
||||
},
|
||||
{
|
||||
"id": "Donald",
|
||||
"type": "person",
|
||||
"pos": {
|
||||
"x": 2094,
|
||||
"y": 129
|
||||
},
|
||||
"width": 155,
|
||||
"height": 126,
|
||||
"opacity": 1,
|
||||
"strokeDash": 0,
|
||||
"strokeWidth": 2,
|
||||
"borderRadius": 0,
|
||||
"fill": "#E3E9FD",
|
||||
"stroke": "#0D32B2",
|
||||
"shadow": false,
|
||||
"3d": false,
|
||||
"multiple": false,
|
||||
"tooltip": "",
|
||||
"link": "",
|
||||
"icon": null,
|
||||
"iconPosition": "",
|
||||
"blend": false,
|
||||
"fields": null,
|
||||
"methods": null,
|
||||
"columns": null,
|
||||
"label": "Donald",
|
||||
"fontSize": 16,
|
||||
"fontFamily": "DEFAULT",
|
||||
"language": "",
|
||||
"color": "#0A0F25",
|
||||
"italic": false,
|
||||
"bold": true,
|
||||
"underline": false,
|
||||
"labelWidth": 55,
|
||||
"labelHeight": 26,
|
||||
"labelPosition": "INSIDE_MIDDLE_CENTER",
|
||||
"zIndex": 0,
|
||||
"level": 1
|
||||
},
|
||||
{
|
||||
"id": "bottom",
|
||||
"type": "text",
|
||||
"pos": {
|
||||
"x": 1546,
|
||||
"y": 388
|
||||
},
|
||||
"width": 943,
|
||||
"height": 130,
|
||||
"opacity": 1,
|
||||
"strokeDash": 0,
|
||||
"strokeWidth": 2,
|
||||
"borderRadius": 0,
|
||||
"fill": "transparent",
|
||||
"stroke": "#0A0F25",
|
||||
"shadow": false,
|
||||
"3d": false,
|
||||
"multiple": false,
|
||||
"tooltip": "",
|
||||
"link": "",
|
||||
"icon": null,
|
||||
"iconPosition": "",
|
||||
"blend": false,
|
||||
"fields": null,
|
||||
"methods": null,
|
||||
"columns": null,
|
||||
"label": "# Cats, no less liquid than their shadows, offer no angles to the wind.\n\nIf we can't fix it, it ain't broke.\n\nDieters live life in the fasting lane.",
|
||||
"fontSize": 16,
|
||||
"fontFamily": "DEFAULT",
|
||||
"language": "markdown",
|
||||
"color": "#0A0F25",
|
||||
"italic": false,
|
||||
"bold": true,
|
||||
"underline": false,
|
||||
"labelWidth": 943,
|
||||
"labelHeight": 130,
|
||||
"labelPosition": "INSIDE_MIDDLE_CENTER",
|
||||
"zIndex": 0,
|
||||
"level": 1
|
||||
},
|
||||
{
|
||||
"id": "i am top left",
|
||||
"type": "text",
|
||||
"pos": {
|
||||
"x": 1445,
|
||||
"y": -28
|
||||
},
|
||||
"width": 81,
|
||||
"height": 24,
|
||||
"opacity": 1,
|
||||
"strokeDash": 0,
|
||||
"strokeWidth": 2,
|
||||
"borderRadius": 0,
|
||||
"fill": "transparent",
|
||||
"stroke": "#0A0F25",
|
||||
"shadow": false,
|
||||
"3d": false,
|
||||
"multiple": false,
|
||||
"tooltip": "",
|
||||
"link": "",
|
||||
"icon": null,
|
||||
"iconPosition": "",
|
||||
"blend": false,
|
||||
"fields": null,
|
||||
"methods": null,
|
||||
"columns": null,
|
||||
"label": "i am top left",
|
||||
"fontSize": 16,
|
||||
"fontFamily": "DEFAULT",
|
||||
"language": "",
|
||||
"color": "#0A0F25",
|
||||
"italic": false,
|
||||
"bold": true,
|
||||
"underline": false,
|
||||
"labelWidth": 81,
|
||||
"labelHeight": 24,
|
||||
"labelPosition": "INSIDE_MIDDLE_CENTER",
|
||||
"zIndex": 0,
|
||||
"level": 1
|
||||
},
|
||||
{
|
||||
"id": "i am top right",
|
||||
"type": "text",
|
||||
"pos": {
|
||||
"x": 2509,
|
||||
"y": -28
|
||||
},
|
||||
"width": 91,
|
||||
"height": 24,
|
||||
"opacity": 1,
|
||||
"strokeDash": 0,
|
||||
"strokeWidth": 2,
|
||||
"borderRadius": 0,
|
||||
"fill": "transparent",
|
||||
"stroke": "#0A0F25",
|
||||
"shadow": false,
|
||||
"3d": false,
|
||||
"multiple": false,
|
||||
"tooltip": "",
|
||||
"link": "",
|
||||
"icon": null,
|
||||
"iconPosition": "",
|
||||
"blend": false,
|
||||
"fields": null,
|
||||
"methods": null,
|
||||
"columns": null,
|
||||
"label": "i am top right",
|
||||
"fontSize": 16,
|
||||
"fontFamily": "DEFAULT",
|
||||
"language": "",
|
||||
"color": "#0A0F25",
|
||||
"italic": false,
|
||||
"bold": true,
|
||||
"underline": false,
|
||||
"labelWidth": 91,
|
||||
"labelHeight": 24,
|
||||
"labelPosition": "INSIDE_MIDDLE_CENTER",
|
||||
"zIndex": 0,
|
||||
"level": 1
|
||||
},
|
||||
{
|
||||
"id": "i am bottom left",
|
||||
"type": "text",
|
||||
"pos": {
|
||||
"x": 1418,
|
||||
"y": 388
|
||||
},
|
||||
"width": 108,
|
||||
"height": 24,
|
||||
"opacity": 1,
|
||||
"strokeDash": 0,
|
||||
"strokeWidth": 2,
|
||||
"borderRadius": 0,
|
||||
"fill": "transparent",
|
||||
"stroke": "#0A0F25",
|
||||
"shadow": false,
|
||||
"3d": false,
|
||||
"multiple": false,
|
||||
"tooltip": "",
|
||||
"link": "",
|
||||
"icon": null,
|
||||
"iconPosition": "",
|
||||
"blend": false,
|
||||
"fields": null,
|
||||
"methods": null,
|
||||
"columns": null,
|
||||
"label": "i am bottom left",
|
||||
"fontSize": 16,
|
||||
"fontFamily": "DEFAULT",
|
||||
"language": "",
|
||||
"color": "#0A0F25",
|
||||
"italic": false,
|
||||
"bold": true,
|
||||
"underline": false,
|
||||
"labelWidth": 108,
|
||||
"labelHeight": 24,
|
||||
"labelPosition": "INSIDE_MIDDLE_CENTER",
|
||||
"zIndex": 0,
|
||||
"level": 1
|
||||
},
|
||||
{
|
||||
"id": "i am bottom right",
|
||||
"type": "text",
|
||||
"pos": {
|
||||
"x": 2509,
|
||||
"y": 388
|
||||
},
|
||||
"width": 118,
|
||||
"height": 24,
|
||||
"opacity": 1,
|
||||
"strokeDash": 0,
|
||||
"strokeWidth": 2,
|
||||
"borderRadius": 0,
|
||||
"fill": "transparent",
|
||||
"stroke": "#0A0F25",
|
||||
"shadow": false,
|
||||
"3d": false,
|
||||
"multiple": false,
|
||||
"tooltip": "",
|
||||
"link": "",
|
||||
"icon": null,
|
||||
"iconPosition": "",
|
||||
"blend": false,
|
||||
"fields": null,
|
||||
"methods": null,
|
||||
"columns": null,
|
||||
"label": "i am bottom right",
|
||||
"fontSize": 16,
|
||||
"fontFamily": "DEFAULT",
|
||||
"language": "",
|
||||
"color": "#0A0F25",
|
||||
"italic": false,
|
||||
"bold": true,
|
||||
"underline": false,
|
||||
"labelWidth": 118,
|
||||
"labelHeight": 24,
|
||||
"labelPosition": "INSIDE_MIDDLE_CENTER",
|
||||
"zIndex": 0,
|
||||
"level": 1
|
||||
}
|
||||
],
|
||||
"connections": [
|
||||
{
|
||||
"id": "(x -> y)[0]",
|
||||
"src": "x",
|
||||
"srcArrow": "none",
|
||||
"srcLabel": "",
|
||||
"dst": "y",
|
||||
"dstArrow": "triangle",
|
||||
"dstLabel": "",
|
||||
"opacity": 1,
|
||||
"strokeDash": 0,
|
||||
"strokeWidth": 2,
|
||||
"stroke": "#0D32B2",
|
||||
"label": "",
|
||||
"fontSize": 16,
|
||||
"fontFamily": "DEFAULT",
|
||||
"language": "",
|
||||
"color": "#676C7E",
|
||||
"italic": true,
|
||||
"bold": false,
|
||||
"underline": false,
|
||||
"labelWidth": 0,
|
||||
"labelHeight": 0,
|
||||
"labelPosition": "",
|
||||
"labelPercentage": 0,
|
||||
"route": [
|
||||
{
|
||||
"x": 2017.5,
|
||||
"y": 142
|
||||
},
|
||||
{
|
||||
"x": 2017.5,
|
||||
"y": 242
|
||||
}
|
||||
],
|
||||
"animated": false,
|
||||
"tooltip": "",
|
||||
"icon": null,
|
||||
"zIndex": 0
|
||||
}
|
||||
]
|
||||
}
|
||||
802
e2etests/testdata/stable/constant_near/elk/sketch.exp.svg
vendored
Normal file
802
e2etests/testdata/stable/constant_near/elk/sketch.exp.svg
vendored
Normal file
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 663 KiB |
Loading…
Reference in a new issue