rename to horizontal-gap and vertical-gap

This commit is contained in:
Gavin Nishizawa 2023-04-12 13:48:53 -07:00
parent 7631efce2b
commit c0e164e44b
No known key found for this signature in database
GPG key ID: AE3B177777CE55CD
13 changed files with 374 additions and 374 deletions

View file

@ -1,7 +1,7 @@
#### Features 🚀 #### Features 🚀
- Export diagrams to `.pptx` (PowerPoint)[#1139](https://github.com/terrastruct/d2/pull/1139) - Export diagrams to `.pptx` (PowerPoint)[#1139](https://github.com/terrastruct/d2/pull/1139)
- Customize gap size in grid diagrams with `grid-gap`, `grid-gap-rows`, or `grid-gap-columns` [#1178](https://github.com/terrastruct/d2/issues/1178) - Customize gap size in grid diagrams with `grid-gap`, `vertical-gap`, or `horizontal-gap` [#1178](https://github.com/terrastruct/d2/issues/1178)
#### Improvements 🧹 #### Improvements 🧹

View file

@ -433,32 +433,32 @@ func (c *compiler) compileReserved(attrs *d2graph.Attributes, f *d2ir.Field) {
attrs.GridGap = &d2graph.Scalar{} attrs.GridGap = &d2graph.Scalar{}
attrs.GridGap.Value = scalar.ScalarString() attrs.GridGap.Value = scalar.ScalarString()
attrs.GridGap.MapKey = f.LastPrimaryKey() attrs.GridGap.MapKey = f.LastPrimaryKey()
case "grid-gap-rows": case "vertical-gap":
v, err := strconv.Atoi(scalar.ScalarString()) v, err := strconv.Atoi(scalar.ScalarString())
if err != nil { if err != nil {
c.errorf(scalar, "non-integer grid-gap-rows %#v: %s", scalar.ScalarString(), err) c.errorf(scalar, "non-integer vertical-gap %#v: %s", scalar.ScalarString(), err)
return return
} }
if v < 0 { if v < 0 {
c.errorf(scalar, "grid-gap-rows must be a non-negative integer: %#v", scalar.ScalarString()) c.errorf(scalar, "vertical-gap must be a non-negative integer: %#v", scalar.ScalarString())
return return
} }
attrs.GridGapRows = &d2graph.Scalar{} attrs.VerticalGap = &d2graph.Scalar{}
attrs.GridGapRows.Value = scalar.ScalarString() attrs.VerticalGap.Value = scalar.ScalarString()
attrs.GridGapRows.MapKey = f.LastPrimaryKey() attrs.VerticalGap.MapKey = f.LastPrimaryKey()
case "grid-gap-columns": case "horizontal-gap":
v, err := strconv.Atoi(scalar.ScalarString()) v, err := strconv.Atoi(scalar.ScalarString())
if err != nil { if err != nil {
c.errorf(scalar, "non-integer grid-gap-columns %#v: %s", scalar.ScalarString(), err) c.errorf(scalar, "non-integer horizontal-gap %#v: %s", scalar.ScalarString(), err)
return return
} }
if v < 0 { if v < 0 {
c.errorf(scalar, "grid-gap-columns must be a non-negative integer: %#v", scalar.ScalarString()) c.errorf(scalar, "horizontal-gap must be a non-negative integer: %#v", scalar.ScalarString())
return return
} }
attrs.GridGapColumns = &d2graph.Scalar{} attrs.HorizontalGap = &d2graph.Scalar{}
attrs.GridGapColumns.Value = scalar.ScalarString() attrs.HorizontalGap.Value = scalar.ScalarString()
attrs.GridGapColumns.MapKey = f.LastPrimaryKey() attrs.HorizontalGap.MapKey = f.LastPrimaryKey()
case "class": case "class":
attrs.Classes = append(attrs.Classes, scalar.ScalarString()) attrs.Classes = append(attrs.Classes, scalar.ScalarString())
case "classes": case "classes":
@ -796,7 +796,7 @@ func (c *compiler) validateKey(obj *d2graph.Object, f *d2ir.Field) {
if !in && arrowheadIn { if !in && arrowheadIn {
c.errorf(f.LastPrimaryKey(), fmt.Sprintf(`invalid shape, can only set "%s" for arrowheads`, obj.Attributes.Shape.Value)) c.errorf(f.LastPrimaryKey(), fmt.Sprintf(`invalid shape, can only set "%s" for arrowheads`, obj.Attributes.Shape.Value))
} }
case "grid-rows", "grid-columns", "grid-gap", "grid-gap-rows", "grid-gap-columns": case "grid-rows", "grid-columns", "grid-gap", "vertical-gap", "horizontal-gap":
for _, child := range obj.ChildrenArray { for _, child := range obj.ChildrenArray {
if child.IsContainer() { if child.IsContainer() {
c.errorf(f.LastPrimaryKey(), c.errorf(f.LastPrimaryKey(),

View file

@ -2304,12 +2304,12 @@ obj {
{ {
name: "grid_gap_negative", name: "grid_gap_negative",
text: `hey: { text: `hey: {
grid-gap-columns: -200 horizontal-gap: -200
grid-gap-rows: -30 vertical-gap: -30
} }
`, `,
expErr: `d2/testdata/d2compiler/TestCompile/grid_gap_negative.d2:2:20: grid-gap-columns must be a non-negative integer: "-200" expErr: `d2/testdata/d2compiler/TestCompile/grid_gap_negative.d2:2:18: horizontal-gap must be a non-negative integer: "-200"
d2/testdata/d2compiler/TestCompile/grid_gap_negative.d2:3:17: grid-gap-rows must be a non-negative integer: "-30"`, d2/testdata/d2compiler/TestCompile/grid_gap_negative.d2:3:16: vertical-gap must be a non-negative integer: "-30"`,
}, },
{ {
name: "grid_edge", name: "grid_edge",

View file

@ -139,8 +139,8 @@ type Attributes struct {
GridRows *Scalar `json:"gridRows,omitempty"` GridRows *Scalar `json:"gridRows,omitempty"`
GridColumns *Scalar `json:"gridColumns,omitempty"` GridColumns *Scalar `json:"gridColumns,omitempty"`
GridGap *Scalar `json:"gridGap,omitempty"` GridGap *Scalar `json:"gridGap,omitempty"`
GridGapRows *Scalar `json:"gridGapRows,omitempty"` VerticalGap *Scalar `json:"verticalGap,omitempty"`
GridGapColumns *Scalar `json:"gridGapColumns,omitempty"` HorizontalGap *Scalar `json:"horizontalGap,omitempty"`
// These names are attached to the rendered elements in SVG // These names are attached to the rendered elements in SVG
// so that users can target them however they like outside of D2 // so that users can target them however they like outside of D2
@ -1607,8 +1607,8 @@ var SimpleReservedKeywords = map[string]struct{}{
"grid-rows": {}, "grid-rows": {},
"grid-columns": {}, "grid-columns": {},
"grid-gap": {}, "grid-gap": {},
"grid-gap-rows": {}, "vertical-gap": {},
"grid-gap-columns": {}, "horizontal-gap": {},
"class": {}, "class": {},
"classes": {}, "classes": {},
} }

View file

@ -20,16 +20,16 @@ type gridDiagram struct {
width float64 width float64
height float64 height float64
gapRows int verticalGap int
gapColumns int horizontalGap int
} }
func newGridDiagram(root *d2graph.Object) *gridDiagram { func newGridDiagram(root *d2graph.Object) *gridDiagram {
gd := gridDiagram{ gd := gridDiagram{
root: root, root: root,
objects: root.ChildrenArray, objects: root.ChildrenArray,
gapRows: DEFAULT_GAP, verticalGap: DEFAULT_GAP,
gapColumns: DEFAULT_GAP, horizontalGap: DEFAULT_GAP,
} }
if root.Attributes.GridRows != nil { if root.Attributes.GridRows != nil {
@ -77,14 +77,14 @@ func newGridDiagram(root *d2graph.Object) *gridDiagram {
// grid gap sets both, but can be overridden // grid gap sets both, but can be overridden
if root.Attributes.GridGap != nil { if root.Attributes.GridGap != nil {
gd.gapRows, _ = strconv.Atoi(root.Attributes.GridGap.Value) gd.verticalGap, _ = strconv.Atoi(root.Attributes.GridGap.Value)
gd.gapColumns = gd.gapRows gd.horizontalGap = gd.verticalGap
} }
if root.Attributes.GridGapRows != nil { if root.Attributes.VerticalGap != nil {
gd.gapRows, _ = strconv.Atoi(root.Attributes.GridGapRows.Value) gd.verticalGap, _ = strconv.Atoi(root.Attributes.VerticalGap.Value)
} }
if root.Attributes.GridGapColumns != nil { if root.Attributes.HorizontalGap != nil {
gd.gapColumns, _ = strconv.Atoi(root.Attributes.GridGapColumns.Value) gd.horizontalGap, _ = strconv.Atoi(root.Attributes.HorizontalGap.Value)
} }
return &gd return &gd

View file

@ -177,8 +177,8 @@ func (gd *gridDiagram) layoutEvenly(g *d2graph.Graph, obj *d2graph.Object) {
colWidths = append(colWidths, columnWidth) colWidths = append(colWidths, columnWidth)
} }
horizontalGap := float64(gd.gapColumns) horizontalGap := float64(gd.horizontalGap)
verticalGap := float64(gd.gapRows) verticalGap := float64(gd.verticalGap)
cursor := geo.NewPoint(0, 0) cursor := geo.NewPoint(0, 0)
if gd.rowDirected { if gd.rowDirected {
@ -242,8 +242,8 @@ func (gd *gridDiagram) layoutDynamic(g *d2graph.Graph, obj *d2graph.Object) {
// . │ │ ├ ─ ┤ │ │ │ │ │ │ // . │ │ ├ ─ ┤ │ │ │ │ │ │
// . └──────────────┘ └───┘ └──────────┘ └─────────┘ └─────────────────┘ // . └──────────────┘ └───┘ └──────────┘ └─────────┘ └─────────────────┘
horizontalGap := float64(gd.gapColumns) horizontalGap := float64(gd.horizontalGap)
verticalGap := float64(gd.gapRows) verticalGap := float64(gd.verticalGap)
// we want to split up the total width across the N rows or columns as evenly as possible // we want to split up the total width across the N rows or columns as evenly as possible
var totalWidth, totalHeight float64 var totalWidth, totalHeight float64
@ -484,7 +484,7 @@ func (gd *gridDiagram) getBestLayout(targetSize float64, columns bool) [][]*d2gr
// of these divisions, find the layout with rows closest to the targetSize // of these divisions, find the layout with rows closest to the targetSize
for _, division := range divisions { for _, division := range divisions {
layout := genLayout(gd.objects, division) layout := genLayout(gd.objects, division)
dist := getDistToTarget(layout, targetSize, float64(gd.gapColumns), float64(gd.gapRows), columns) dist := getDistToTarget(layout, targetSize, float64(gd.horizontalGap), float64(gd.verticalGap), columns)
if dist < bestDist { if dist < bestDist {
bestLayout = layout bestLayout = layout
bestDist = dist bestDist = dist

View file

@ -329,14 +329,14 @@ func _set(g *d2graph.Graph, key string, tag, value *string) error {
attrs.GridGap.MapKey.SetScalar(mk.Value.ScalarBox()) attrs.GridGap.MapKey.SetScalar(mk.Value.ScalarBox())
return nil return nil
} }
case "grid-gap-rows": case "vertical-gap":
if attrs.GridGapRows != nil && attrs.GridGapRows.MapKey != nil { if attrs.VerticalGap != nil && attrs.VerticalGap.MapKey != nil {
attrs.GridGapRows.MapKey.SetScalar(mk.Value.ScalarBox()) attrs.VerticalGap.MapKey.SetScalar(mk.Value.ScalarBox())
return nil return nil
} }
case "grid-gap-columns": case "horizontal-gap":
if attrs.GridGapColumns != nil && attrs.GridGapColumns.MapKey != nil { if attrs.HorizontalGap != nil && attrs.HorizontalGap.MapKey != nil {
attrs.GridGapColumns.MapKey.SetScalar(mk.Value.ScalarBox()) attrs.HorizontalGap.MapKey.SetScalar(mk.Value.ScalarBox())
return nil return nil
} }
case "source-arrowhead", "target-arrowhead": case "source-arrowhead", "target-arrowhead":

View file

@ -1,8 +1,8 @@
gap-rows 30 gap-columns 100: { vertical-gap 30 horizontal-gap 100: {
grid-rows: 3 grid-rows: 3
grid-columns: 3 grid-columns: 3
grid-gap-rows: 30 vertical-gap: 30
grid-gap-columns: 100 horizontal-gap: 100
a a
b b
@ -15,11 +15,11 @@ gap-rows 30 gap-columns 100: {
i i
} }
gap-rows 100 gap-columns 30: { vertical-gap 100 horizontal-gap 30: {
grid-rows: 3 grid-rows: 3
grid-columns: 3 grid-columns: 3
grid-gap-rows: 100 vertical-gap: 100
grid-gap-columns: 30 horizontal-gap: 30
a a
b b
@ -48,11 +48,11 @@ gap 0: {
i i
} }
gap 10 gap-rows 100: { gap 10 vertical-gap 100: {
grid-rows: 3 grid-rows: 3
grid-columns: 3 grid-columns: 3
grid-gap: 10 grid-gap: 10
grid-gap-rows: 100 vertical-gap: 100
a a
b b

View file

@ -4,7 +4,7 @@
"fontFamily": "SourceSansPro", "fontFamily": "SourceSansPro",
"shapes": [ "shapes": [
{ {
"id": "gap-rows 30 gap-columns 100", "id": "vertical-gap 30 horizontal-gap 100",
"type": "rectangle", "type": "rectangle",
"pos": { "pos": {
"x": 0, "x": 0,
@ -30,7 +30,7 @@
"fields": null, "fields": null,
"methods": null, "methods": null,
"columns": null, "columns": null,
"label": "gap-rows 30 gap-columns 100", "label": "vertical-gap 30 horizontal-gap 100",
"fontSize": 28, "fontSize": 28,
"fontFamily": "DEFAULT", "fontFamily": "DEFAULT",
"language": "", "language": "",
@ -38,14 +38,14 @@
"italic": false, "italic": false,
"bold": false, "bold": false,
"underline": false, "underline": false,
"labelWidth": 347, "labelWidth": 398,
"labelHeight": 36, "labelHeight": 36,
"labelPosition": "INSIDE_TOP_CENTER", "labelPosition": "INSIDE_TOP_CENTER",
"zIndex": 0, "zIndex": 0,
"level": 1 "level": 1
}, },
{ {
"id": "gap-rows 30 gap-columns 100.a", "id": "vertical-gap 30 horizontal-gap 100.a",
"type": "rectangle", "type": "rectangle",
"pos": { "pos": {
"x": 60, "x": 60,
@ -86,7 +86,7 @@
"level": 2 "level": 2
}, },
{ {
"id": "gap-rows 30 gap-columns 100.b", "id": "vertical-gap 30 horizontal-gap 100.b",
"type": "rectangle", "type": "rectangle",
"pos": { "pos": {
"x": 214, "x": 214,
@ -127,7 +127,7 @@
"level": 2 "level": 2
}, },
{ {
"id": "gap-rows 30 gap-columns 100.c", "id": "vertical-gap 30 horizontal-gap 100.c",
"type": "rectangle", "type": "rectangle",
"pos": { "pos": {
"x": 367, "x": 367,
@ -168,7 +168,7 @@
"level": 2 "level": 2
}, },
{ {
"id": "gap-rows 30 gap-columns 100.d", "id": "vertical-gap 30 horizontal-gap 100.d",
"type": "rectangle", "type": "rectangle",
"pos": { "pos": {
"x": 60, "x": 60,
@ -209,7 +209,7 @@
"level": 2 "level": 2
}, },
{ {
"id": "gap-rows 30 gap-columns 100.e", "id": "vertical-gap 30 horizontal-gap 100.e",
"type": "rectangle", "type": "rectangle",
"pos": { "pos": {
"x": 214, "x": 214,
@ -250,7 +250,7 @@
"level": 2 "level": 2
}, },
{ {
"id": "gap-rows 30 gap-columns 100.f", "id": "vertical-gap 30 horizontal-gap 100.f",
"type": "rectangle", "type": "rectangle",
"pos": { "pos": {
"x": 367, "x": 367,
@ -291,7 +291,7 @@
"level": 2 "level": 2
}, },
{ {
"id": "gap-rows 30 gap-columns 100.g", "id": "vertical-gap 30 horizontal-gap 100.g",
"type": "rectangle", "type": "rectangle",
"pos": { "pos": {
"x": 60, "x": 60,
@ -332,7 +332,7 @@
"level": 2 "level": 2
}, },
{ {
"id": "gap-rows 30 gap-columns 100.h", "id": "vertical-gap 30 horizontal-gap 100.h",
"type": "rectangle", "type": "rectangle",
"pos": { "pos": {
"x": 214, "x": 214,
@ -373,7 +373,7 @@
"level": 2 "level": 2
}, },
{ {
"id": "gap-rows 30 gap-columns 100.i", "id": "vertical-gap 30 horizontal-gap 100.i",
"type": "rectangle", "type": "rectangle",
"pos": { "pos": {
"x": 367, "x": 367,
@ -414,13 +414,13 @@
"level": 2 "level": 2
}, },
{ {
"id": "gap-rows 100 gap-columns 30", "id": "vertical-gap 100 horizontal-gap 30",
"type": "rectangle", "type": "rectangle",
"pos": { "pos": {
"x": 540, "x": 540,
"y": 0 "y": 0
}, },
"width": 357, "width": 408,
"height": 518, "height": 518,
"opacity": 1, "opacity": 1,
"strokeDash": 0, "strokeDash": 0,
@ -440,7 +440,7 @@
"fields": null, "fields": null,
"methods": null, "methods": null,
"columns": null, "columns": null,
"label": "gap-rows 100 gap-columns 30", "label": "vertical-gap 100 horizontal-gap 30",
"fontSize": 28, "fontSize": 28,
"fontFamily": "DEFAULT", "fontFamily": "DEFAULT",
"language": "", "language": "",
@ -448,17 +448,17 @@
"italic": false, "italic": false,
"bold": false, "bold": false,
"underline": false, "underline": false,
"labelWidth": 347, "labelWidth": 398,
"labelHeight": 36, "labelHeight": 36,
"labelPosition": "INSIDE_TOP_CENTER", "labelPosition": "INSIDE_TOP_CENTER",
"zIndex": 0, "zIndex": 0,
"level": 1 "level": 1
}, },
{ {
"id": "gap-rows 100 gap-columns 30.a", "id": "vertical-gap 100 horizontal-gap 30.a",
"type": "rectangle", "type": "rectangle",
"pos": { "pos": {
"x": 608, "x": 634,
"y": 60 "y": 60
}, },
"width": 54, "width": 54,
@ -496,10 +496,10 @@
"level": 2 "level": 2
}, },
{ {
"id": "gap-rows 100 gap-columns 30.b", "id": "vertical-gap 100 horizontal-gap 30.b",
"type": "rectangle", "type": "rectangle",
"pos": { "pos": {
"x": 692, "x": 718,
"y": 60 "y": 60
}, },
"width": 53, "width": 53,
@ -537,10 +537,10 @@
"level": 2 "level": 2
}, },
{ {
"id": "gap-rows 100 gap-columns 30.c", "id": "vertical-gap 100 horizontal-gap 30.c",
"type": "rectangle", "type": "rectangle",
"pos": { "pos": {
"x": 775, "x": 801,
"y": 60 "y": 60
}, },
"width": 53, "width": 53,
@ -578,10 +578,10 @@
"level": 2 "level": 2
}, },
{ {
"id": "gap-rows 100 gap-columns 30.d", "id": "vertical-gap 100 horizontal-gap 30.d",
"type": "rectangle", "type": "rectangle",
"pos": { "pos": {
"x": 608, "x": 634,
"y": 226 "y": 226
}, },
"width": 54, "width": 54,
@ -619,10 +619,10 @@
"level": 2 "level": 2
}, },
{ {
"id": "gap-rows 100 gap-columns 30.e", "id": "vertical-gap 100 horizontal-gap 30.e",
"type": "rectangle", "type": "rectangle",
"pos": { "pos": {
"x": 692, "x": 718,
"y": 226 "y": 226
}, },
"width": 53, "width": 53,
@ -660,10 +660,10 @@
"level": 2 "level": 2
}, },
{ {
"id": "gap-rows 100 gap-columns 30.f", "id": "vertical-gap 100 horizontal-gap 30.f",
"type": "rectangle", "type": "rectangle",
"pos": { "pos": {
"x": 775, "x": 801,
"y": 226 "y": 226
}, },
"width": 53, "width": 53,
@ -701,10 +701,10 @@
"level": 2 "level": 2
}, },
{ {
"id": "gap-rows 100 gap-columns 30.g", "id": "vertical-gap 100 horizontal-gap 30.g",
"type": "rectangle", "type": "rectangle",
"pos": { "pos": {
"x": 608, "x": 634,
"y": 392 "y": 392
}, },
"width": 54, "width": 54,
@ -742,10 +742,10 @@
"level": 2 "level": 2
}, },
{ {
"id": "gap-rows 100 gap-columns 30.h", "id": "vertical-gap 100 horizontal-gap 30.h",
"type": "rectangle", "type": "rectangle",
"pos": { "pos": {
"x": 692, "x": 718,
"y": 392 "y": 392
}, },
"width": 53, "width": 53,
@ -783,10 +783,10 @@
"level": 2 "level": 2
}, },
{ {
"id": "gap-rows 100 gap-columns 30.i", "id": "vertical-gap 100 horizontal-gap 30.i",
"type": "rectangle", "type": "rectangle",
"pos": { "pos": {
"x": 775, "x": 801,
"y": 392 "y": 392
}, },
"width": 53, "width": 53,
@ -827,7 +827,7 @@
"id": "gap 0", "id": "gap 0",
"type": "rectangle", "type": "rectangle",
"pos": { "pos": {
"x": 957, "x": 1008,
"y": 100 "y": 100
}, },
"width": 280, "width": 280,
@ -868,7 +868,7 @@
"id": "gap 0.a", "id": "gap 0.a",
"type": "rectangle", "type": "rectangle",
"pos": { "pos": {
"x": 1017, "x": 1068,
"y": 160 "y": 160
}, },
"width": 54, "width": 54,
@ -909,7 +909,7 @@
"id": "gap 0.b", "id": "gap 0.b",
"type": "rectangle", "type": "rectangle",
"pos": { "pos": {
"x": 1071, "x": 1122,
"y": 160 "y": 160
}, },
"width": 53, "width": 53,
@ -950,7 +950,7 @@
"id": "gap 0.c", "id": "gap 0.c",
"type": "rectangle", "type": "rectangle",
"pos": { "pos": {
"x": 1124, "x": 1175,
"y": 160 "y": 160
}, },
"width": 53, "width": 53,
@ -991,7 +991,7 @@
"id": "gap 0.d", "id": "gap 0.d",
"type": "rectangle", "type": "rectangle",
"pos": { "pos": {
"x": 1017, "x": 1068,
"y": 226 "y": 226
}, },
"width": 54, "width": 54,
@ -1032,7 +1032,7 @@
"id": "gap 0.e", "id": "gap 0.e",
"type": "rectangle", "type": "rectangle",
"pos": { "pos": {
"x": 1071, "x": 1122,
"y": 226 "y": 226
}, },
"width": 53, "width": 53,
@ -1073,7 +1073,7 @@
"id": "gap 0.f", "id": "gap 0.f",
"type": "rectangle", "type": "rectangle",
"pos": { "pos": {
"x": 1124, "x": 1175,
"y": 226 "y": 226
}, },
"width": 53, "width": 53,
@ -1114,7 +1114,7 @@
"id": "gap 0.g", "id": "gap 0.g",
"type": "rectangle", "type": "rectangle",
"pos": { "pos": {
"x": 1017, "x": 1068,
"y": 292 "y": 292
}, },
"width": 54, "width": 54,
@ -1155,7 +1155,7 @@
"id": "gap 0.h", "id": "gap 0.h",
"type": "rectangle", "type": "rectangle",
"pos": { "pos": {
"x": 1071, "x": 1122,
"y": 292 "y": 292
}, },
"width": 53, "width": 53,
@ -1196,7 +1196,7 @@
"id": "gap 0.i", "id": "gap 0.i",
"type": "rectangle", "type": "rectangle",
"pos": { "pos": {
"x": 1124, "x": 1175,
"y": 292 "y": 292
}, },
"width": 53, "width": 53,
@ -1234,10 +1234,10 @@
"level": 2 "level": 2
}, },
{ {
"id": "gap 10 gap-rows 100", "id": "gap 10 vertical-gap 100",
"type": "rectangle", "type": "rectangle",
"pos": { "pos": {
"x": 1297, "x": 1348,
"y": 0 "y": 0
}, },
"width": 300, "width": 300,
@ -1260,7 +1260,7 @@
"fields": null, "fields": null,
"methods": null, "methods": null,
"columns": null, "columns": null,
"label": "gap 10 gap-rows 100", "label": "gap 10 vertical-gap 100",
"fontSize": 28, "fontSize": 28,
"fontFamily": "DEFAULT", "fontFamily": "DEFAULT",
"language": "", "language": "",
@ -1268,17 +1268,17 @@
"italic": false, "italic": false,
"bold": false, "bold": false,
"underline": false, "underline": false,
"labelWidth": 238, "labelWidth": 268,
"labelHeight": 36, "labelHeight": 36,
"labelPosition": "INSIDE_TOP_CENTER", "labelPosition": "INSIDE_TOP_CENTER",
"zIndex": 0, "zIndex": 0,
"level": 1 "level": 1
}, },
{ {
"id": "gap 10 gap-rows 100.a", "id": "gap 10 vertical-gap 100.a",
"type": "rectangle", "type": "rectangle",
"pos": { "pos": {
"x": 1357, "x": 1408,
"y": 60 "y": 60
}, },
"width": 54, "width": 54,
@ -1316,10 +1316,10 @@
"level": 2 "level": 2
}, },
{ {
"id": "gap 10 gap-rows 100.b", "id": "gap 10 vertical-gap 100.b",
"type": "rectangle", "type": "rectangle",
"pos": { "pos": {
"x": 1421, "x": 1472,
"y": 60 "y": 60
}, },
"width": 53, "width": 53,
@ -1357,10 +1357,10 @@
"level": 2 "level": 2
}, },
{ {
"id": "gap 10 gap-rows 100.c", "id": "gap 10 vertical-gap 100.c",
"type": "rectangle", "type": "rectangle",
"pos": { "pos": {
"x": 1484, "x": 1535,
"y": 60 "y": 60
}, },
"width": 53, "width": 53,
@ -1398,10 +1398,10 @@
"level": 2 "level": 2
}, },
{ {
"id": "gap 10 gap-rows 100.d", "id": "gap 10 vertical-gap 100.d",
"type": "rectangle", "type": "rectangle",
"pos": { "pos": {
"x": 1357, "x": 1408,
"y": 226 "y": 226
}, },
"width": 54, "width": 54,
@ -1439,10 +1439,10 @@
"level": 2 "level": 2
}, },
{ {
"id": "gap 10 gap-rows 100.e", "id": "gap 10 vertical-gap 100.e",
"type": "rectangle", "type": "rectangle",
"pos": { "pos": {
"x": 1421, "x": 1472,
"y": 226 "y": 226
}, },
"width": 53, "width": 53,
@ -1480,10 +1480,10 @@
"level": 2 "level": 2
}, },
{ {
"id": "gap 10 gap-rows 100.f", "id": "gap 10 vertical-gap 100.f",
"type": "rectangle", "type": "rectangle",
"pos": { "pos": {
"x": 1484, "x": 1535,
"y": 226 "y": 226
}, },
"width": 53, "width": 53,
@ -1521,10 +1521,10 @@
"level": 2 "level": 2
}, },
{ {
"id": "gap 10 gap-rows 100.g", "id": "gap 10 vertical-gap 100.g",
"type": "rectangle", "type": "rectangle",
"pos": { "pos": {
"x": 1357, "x": 1408,
"y": 392 "y": 392
}, },
"width": 54, "width": 54,
@ -1562,10 +1562,10 @@
"level": 2 "level": 2
}, },
{ {
"id": "gap 10 gap-rows 100.h", "id": "gap 10 vertical-gap 100.h",
"type": "rectangle", "type": "rectangle",
"pos": { "pos": {
"x": 1421, "x": 1472,
"y": 392 "y": 392
}, },
"width": 53, "width": 53,
@ -1603,10 +1603,10 @@
"level": 2 "level": 2
}, },
{ {
"id": "gap 10 gap-rows 100.i", "id": "gap 10 vertical-gap 100.i",
"type": "rectangle", "type": "rectangle",
"pos": { "pos": {
"x": 1484, "x": 1535,
"y": 392 "y": 392
}, },
"width": 53, "width": 53,

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 26 KiB

View file

@ -4,7 +4,7 @@
"fontFamily": "SourceSansPro", "fontFamily": "SourceSansPro",
"shapes": [ "shapes": [
{ {
"id": "gap-rows 30 gap-columns 100", "id": "vertical-gap 30 horizontal-gap 100",
"type": "rectangle", "type": "rectangle",
"pos": { "pos": {
"x": 12, "x": 12,
@ -30,7 +30,7 @@
"fields": null, "fields": null,
"methods": null, "methods": null,
"columns": null, "columns": null,
"label": "gap-rows 30 gap-columns 100", "label": "vertical-gap 30 horizontal-gap 100",
"fontSize": 28, "fontSize": 28,
"fontFamily": "DEFAULT", "fontFamily": "DEFAULT",
"language": "", "language": "",
@ -38,14 +38,14 @@
"italic": false, "italic": false,
"bold": false, "bold": false,
"underline": false, "underline": false,
"labelWidth": 347, "labelWidth": 398,
"labelHeight": 36, "labelHeight": 36,
"labelPosition": "INSIDE_TOP_CENTER", "labelPosition": "INSIDE_TOP_CENTER",
"zIndex": 0, "zIndex": 0,
"level": 1 "level": 1
}, },
{ {
"id": "gap-rows 30 gap-columns 100.a", "id": "vertical-gap 30 horizontal-gap 100.a",
"type": "rectangle", "type": "rectangle",
"pos": { "pos": {
"x": 72, "x": 72,
@ -86,7 +86,7 @@
"level": 2 "level": 2
}, },
{ {
"id": "gap-rows 30 gap-columns 100.b", "id": "vertical-gap 30 horizontal-gap 100.b",
"type": "rectangle", "type": "rectangle",
"pos": { "pos": {
"x": 226, "x": 226,
@ -127,7 +127,7 @@
"level": 2 "level": 2
}, },
{ {
"id": "gap-rows 30 gap-columns 100.c", "id": "vertical-gap 30 horizontal-gap 100.c",
"type": "rectangle", "type": "rectangle",
"pos": { "pos": {
"x": 379, "x": 379,
@ -168,7 +168,7 @@
"level": 2 "level": 2
}, },
{ {
"id": "gap-rows 30 gap-columns 100.d", "id": "vertical-gap 30 horizontal-gap 100.d",
"type": "rectangle", "type": "rectangle",
"pos": { "pos": {
"x": 72, "x": 72,
@ -209,7 +209,7 @@
"level": 2 "level": 2
}, },
{ {
"id": "gap-rows 30 gap-columns 100.e", "id": "vertical-gap 30 horizontal-gap 100.e",
"type": "rectangle", "type": "rectangle",
"pos": { "pos": {
"x": 226, "x": 226,
@ -250,7 +250,7 @@
"level": 2 "level": 2
}, },
{ {
"id": "gap-rows 30 gap-columns 100.f", "id": "vertical-gap 30 horizontal-gap 100.f",
"type": "rectangle", "type": "rectangle",
"pos": { "pos": {
"x": 379, "x": 379,
@ -291,7 +291,7 @@
"level": 2 "level": 2
}, },
{ {
"id": "gap-rows 30 gap-columns 100.g", "id": "vertical-gap 30 horizontal-gap 100.g",
"type": "rectangle", "type": "rectangle",
"pos": { "pos": {
"x": 72, "x": 72,
@ -332,7 +332,7 @@
"level": 2 "level": 2
}, },
{ {
"id": "gap-rows 30 gap-columns 100.h", "id": "vertical-gap 30 horizontal-gap 100.h",
"type": "rectangle", "type": "rectangle",
"pos": { "pos": {
"x": 226, "x": 226,
@ -373,7 +373,7 @@
"level": 2 "level": 2
}, },
{ {
"id": "gap-rows 30 gap-columns 100.i", "id": "vertical-gap 30 horizontal-gap 100.i",
"type": "rectangle", "type": "rectangle",
"pos": { "pos": {
"x": 379, "x": 379,
@ -414,13 +414,13 @@
"level": 2 "level": 2
}, },
{ {
"id": "gap-rows 100 gap-columns 30", "id": "vertical-gap 100 horizontal-gap 30",
"type": "rectangle", "type": "rectangle",
"pos": { "pos": {
"x": 512, "x": 512,
"y": 12 "y": 12
}, },
"width": 357, "width": 408,
"height": 518, "height": 518,
"opacity": 1, "opacity": 1,
"strokeDash": 0, "strokeDash": 0,
@ -440,7 +440,7 @@
"fields": null, "fields": null,
"methods": null, "methods": null,
"columns": null, "columns": null,
"label": "gap-rows 100 gap-columns 30", "label": "vertical-gap 100 horizontal-gap 30",
"fontSize": 28, "fontSize": 28,
"fontFamily": "DEFAULT", "fontFamily": "DEFAULT",
"language": "", "language": "",
@ -448,17 +448,17 @@
"italic": false, "italic": false,
"bold": false, "bold": false,
"underline": false, "underline": false,
"labelWidth": 347, "labelWidth": 398,
"labelHeight": 36, "labelHeight": 36,
"labelPosition": "INSIDE_TOP_CENTER", "labelPosition": "INSIDE_TOP_CENTER",
"zIndex": 0, "zIndex": 0,
"level": 1 "level": 1
}, },
{ {
"id": "gap-rows 100 gap-columns 30.a", "id": "vertical-gap 100 horizontal-gap 30.a",
"type": "rectangle", "type": "rectangle",
"pos": { "pos": {
"x": 580, "x": 606,
"y": 72 "y": 72
}, },
"width": 54, "width": 54,
@ -496,10 +496,10 @@
"level": 2 "level": 2
}, },
{ {
"id": "gap-rows 100 gap-columns 30.b", "id": "vertical-gap 100 horizontal-gap 30.b",
"type": "rectangle", "type": "rectangle",
"pos": { "pos": {
"x": 664, "x": 690,
"y": 72 "y": 72
}, },
"width": 53, "width": 53,
@ -537,10 +537,10 @@
"level": 2 "level": 2
}, },
{ {
"id": "gap-rows 100 gap-columns 30.c", "id": "vertical-gap 100 horizontal-gap 30.c",
"type": "rectangle", "type": "rectangle",
"pos": { "pos": {
"x": 747, "x": 773,
"y": 72 "y": 72
}, },
"width": 53, "width": 53,
@ -578,10 +578,10 @@
"level": 2 "level": 2
}, },
{ {
"id": "gap-rows 100 gap-columns 30.d", "id": "vertical-gap 100 horizontal-gap 30.d",
"type": "rectangle", "type": "rectangle",
"pos": { "pos": {
"x": 580, "x": 606,
"y": 238 "y": 238
}, },
"width": 54, "width": 54,
@ -619,10 +619,10 @@
"level": 2 "level": 2
}, },
{ {
"id": "gap-rows 100 gap-columns 30.e", "id": "vertical-gap 100 horizontal-gap 30.e",
"type": "rectangle", "type": "rectangle",
"pos": { "pos": {
"x": 664, "x": 690,
"y": 238 "y": 238
}, },
"width": 53, "width": 53,
@ -660,10 +660,10 @@
"level": 2 "level": 2
}, },
{ {
"id": "gap-rows 100 gap-columns 30.f", "id": "vertical-gap 100 horizontal-gap 30.f",
"type": "rectangle", "type": "rectangle",
"pos": { "pos": {
"x": 747, "x": 773,
"y": 238 "y": 238
}, },
"width": 53, "width": 53,
@ -701,10 +701,10 @@
"level": 2 "level": 2
}, },
{ {
"id": "gap-rows 100 gap-columns 30.g", "id": "vertical-gap 100 horizontal-gap 30.g",
"type": "rectangle", "type": "rectangle",
"pos": { "pos": {
"x": 580, "x": 606,
"y": 404 "y": 404
}, },
"width": 54, "width": 54,
@ -742,10 +742,10 @@
"level": 2 "level": 2
}, },
{ {
"id": "gap-rows 100 gap-columns 30.h", "id": "vertical-gap 100 horizontal-gap 30.h",
"type": "rectangle", "type": "rectangle",
"pos": { "pos": {
"x": 664, "x": 690,
"y": 404 "y": 404
}, },
"width": 53, "width": 53,
@ -783,10 +783,10 @@
"level": 2 "level": 2
}, },
{ {
"id": "gap-rows 100 gap-columns 30.i", "id": "vertical-gap 100 horizontal-gap 30.i",
"type": "rectangle", "type": "rectangle",
"pos": { "pos": {
"x": 747, "x": 773,
"y": 404 "y": 404
}, },
"width": 53, "width": 53,
@ -827,7 +827,7 @@
"id": "gap 0", "id": "gap 0",
"type": "rectangle", "type": "rectangle",
"pos": { "pos": {
"x": 889, "x": 940,
"y": 112 "y": 112
}, },
"width": 280, "width": 280,
@ -868,7 +868,7 @@
"id": "gap 0.a", "id": "gap 0.a",
"type": "rectangle", "type": "rectangle",
"pos": { "pos": {
"x": 949, "x": 1000,
"y": 172 "y": 172
}, },
"width": 54, "width": 54,
@ -909,7 +909,7 @@
"id": "gap 0.b", "id": "gap 0.b",
"type": "rectangle", "type": "rectangle",
"pos": { "pos": {
"x": 1003, "x": 1054,
"y": 172 "y": 172
}, },
"width": 53, "width": 53,
@ -950,7 +950,7 @@
"id": "gap 0.c", "id": "gap 0.c",
"type": "rectangle", "type": "rectangle",
"pos": { "pos": {
"x": 1056, "x": 1107,
"y": 172 "y": 172
}, },
"width": 53, "width": 53,
@ -991,7 +991,7 @@
"id": "gap 0.d", "id": "gap 0.d",
"type": "rectangle", "type": "rectangle",
"pos": { "pos": {
"x": 949, "x": 1000,
"y": 238 "y": 238
}, },
"width": 54, "width": 54,
@ -1032,7 +1032,7 @@
"id": "gap 0.e", "id": "gap 0.e",
"type": "rectangle", "type": "rectangle",
"pos": { "pos": {
"x": 1003, "x": 1054,
"y": 238 "y": 238
}, },
"width": 53, "width": 53,
@ -1073,7 +1073,7 @@
"id": "gap 0.f", "id": "gap 0.f",
"type": "rectangle", "type": "rectangle",
"pos": { "pos": {
"x": 1056, "x": 1107,
"y": 238 "y": 238
}, },
"width": 53, "width": 53,
@ -1114,7 +1114,7 @@
"id": "gap 0.g", "id": "gap 0.g",
"type": "rectangle", "type": "rectangle",
"pos": { "pos": {
"x": 949, "x": 1000,
"y": 304 "y": 304
}, },
"width": 54, "width": 54,
@ -1155,7 +1155,7 @@
"id": "gap 0.h", "id": "gap 0.h",
"type": "rectangle", "type": "rectangle",
"pos": { "pos": {
"x": 1003, "x": 1054,
"y": 304 "y": 304
}, },
"width": 53, "width": 53,
@ -1196,7 +1196,7 @@
"id": "gap 0.i", "id": "gap 0.i",
"type": "rectangle", "type": "rectangle",
"pos": { "pos": {
"x": 1056, "x": 1107,
"y": 304 "y": 304
}, },
"width": 53, "width": 53,
@ -1234,10 +1234,10 @@
"level": 2 "level": 2
}, },
{ {
"id": "gap 10 gap-rows 100", "id": "gap 10 vertical-gap 100",
"type": "rectangle", "type": "rectangle",
"pos": { "pos": {
"x": 1189, "x": 1240,
"y": 12 "y": 12
}, },
"width": 300, "width": 300,
@ -1260,7 +1260,7 @@
"fields": null, "fields": null,
"methods": null, "methods": null,
"columns": null, "columns": null,
"label": "gap 10 gap-rows 100", "label": "gap 10 vertical-gap 100",
"fontSize": 28, "fontSize": 28,
"fontFamily": "DEFAULT", "fontFamily": "DEFAULT",
"language": "", "language": "",
@ -1268,17 +1268,17 @@
"italic": false, "italic": false,
"bold": false, "bold": false,
"underline": false, "underline": false,
"labelWidth": 238, "labelWidth": 268,
"labelHeight": 36, "labelHeight": 36,
"labelPosition": "INSIDE_TOP_CENTER", "labelPosition": "INSIDE_TOP_CENTER",
"zIndex": 0, "zIndex": 0,
"level": 1 "level": 1
}, },
{ {
"id": "gap 10 gap-rows 100.a", "id": "gap 10 vertical-gap 100.a",
"type": "rectangle", "type": "rectangle",
"pos": { "pos": {
"x": 1249, "x": 1300,
"y": 72 "y": 72
}, },
"width": 54, "width": 54,
@ -1316,10 +1316,10 @@
"level": 2 "level": 2
}, },
{ {
"id": "gap 10 gap-rows 100.b", "id": "gap 10 vertical-gap 100.b",
"type": "rectangle", "type": "rectangle",
"pos": { "pos": {
"x": 1313, "x": 1364,
"y": 72 "y": 72
}, },
"width": 53, "width": 53,
@ -1357,10 +1357,10 @@
"level": 2 "level": 2
}, },
{ {
"id": "gap 10 gap-rows 100.c", "id": "gap 10 vertical-gap 100.c",
"type": "rectangle", "type": "rectangle",
"pos": { "pos": {
"x": 1376, "x": 1427,
"y": 72 "y": 72
}, },
"width": 53, "width": 53,
@ -1398,10 +1398,10 @@
"level": 2 "level": 2
}, },
{ {
"id": "gap 10 gap-rows 100.d", "id": "gap 10 vertical-gap 100.d",
"type": "rectangle", "type": "rectangle",
"pos": { "pos": {
"x": 1249, "x": 1300,
"y": 238 "y": 238
}, },
"width": 54, "width": 54,
@ -1439,10 +1439,10 @@
"level": 2 "level": 2
}, },
{ {
"id": "gap 10 gap-rows 100.e", "id": "gap 10 vertical-gap 100.e",
"type": "rectangle", "type": "rectangle",
"pos": { "pos": {
"x": 1313, "x": 1364,
"y": 238 "y": 238
}, },
"width": 53, "width": 53,
@ -1480,10 +1480,10 @@
"level": 2 "level": 2
}, },
{ {
"id": "gap 10 gap-rows 100.f", "id": "gap 10 vertical-gap 100.f",
"type": "rectangle", "type": "rectangle",
"pos": { "pos": {
"x": 1376, "x": 1427,
"y": 238 "y": 238
}, },
"width": 53, "width": 53,
@ -1521,10 +1521,10 @@
"level": 2 "level": 2
}, },
{ {
"id": "gap 10 gap-rows 100.g", "id": "gap 10 vertical-gap 100.g",
"type": "rectangle", "type": "rectangle",
"pos": { "pos": {
"x": 1249, "x": 1300,
"y": 404 "y": 404
}, },
"width": 54, "width": 54,
@ -1562,10 +1562,10 @@
"level": 2 "level": 2
}, },
{ {
"id": "gap 10 gap-rows 100.h", "id": "gap 10 vertical-gap 100.h",
"type": "rectangle", "type": "rectangle",
"pos": { "pos": {
"x": 1313, "x": 1364,
"y": 404 "y": 404
}, },
"width": 53, "width": 53,
@ -1603,10 +1603,10 @@
"level": 2 "level": 2
}, },
{ {
"id": "gap 10 gap-rows 100.i", "id": "gap 10 vertical-gap 100.i",
"type": "rectangle", "type": "rectangle",
"pos": { "pos": {
"x": 1376, "x": 1427,
"y": 404 "y": 404
}, },
"width": 53, "width": 53,

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 26 KiB

View file

@ -4,12 +4,12 @@
"ioerr": null, "ioerr": null,
"errs": [ "errs": [
{ {
"range": "d2/testdata/d2compiler/TestCompile/grid_gap_negative.d2,1:19:26-1:23:30", "range": "d2/testdata/d2compiler/TestCompile/grid_gap_negative.d2,1:17:24-1:21:28",
"errmsg": "d2/testdata/d2compiler/TestCompile/grid_gap_negative.d2:2:20: grid-gap-columns must be a non-negative integer: \"-200\"" "errmsg": "d2/testdata/d2compiler/TestCompile/grid_gap_negative.d2:2:18: horizontal-gap must be a non-negative integer: \"-200\""
}, },
{ {
"range": "d2/testdata/d2compiler/TestCompile/grid_gap_negative.d2,2:16:47-2:19:50", "range": "d2/testdata/d2compiler/TestCompile/grid_gap_negative.d2,2:15:44-2:18:47",
"errmsg": "d2/testdata/d2compiler/TestCompile/grid_gap_negative.d2:3:17: grid-gap-rows must be a non-negative integer: \"-30\"" "errmsg": "d2/testdata/d2compiler/TestCompile/grid_gap_negative.d2:3:16: vertical-gap must be a non-negative integer: \"-30\""
} }
] ]
} }