support setting width/height on non-image shapes

This commit is contained in:
Gavin Nishizawa 2022-12-21 21:36:08 -08:00
parent 6cb72cb417
commit 5d4059e470
No known key found for this signature in database
GPG key ID: AE3B177777CE55CD
12 changed files with 2837 additions and 186 deletions

View file

@ -801,13 +801,6 @@ func (c *compiler) validateKey(obj *d2graph.Object, m *d2ast.Map, mk *d2ast.Key)
c.errorf(mk.Range.Start, mk.Range.End, "image shapes cannot have children.")
}
if reserved == "width" && obj.Attributes.Shape.Value != d2target.ShapeImage {
c.errorf(mk.Range.Start, mk.Range.End, "width is only applicable to image shapes.")
}
if reserved == "height" && obj.Attributes.Shape.Value != d2target.ShapeImage {
c.errorf(mk.Range.Start, mk.Range.End, "height is only applicable to image shapes.")
}
in := d2target.IsShape(obj.Attributes.Shape.Value)
_, arrowheadIn := d2target.Arrowheads[obj.Attributes.Shape.Value]
if !in && arrowheadIn {

View file

@ -94,9 +94,6 @@ x: {
width: 200
height: 230
}
`,
expErr: `d2/testdata/d2compiler/TestCompile/dimensions_on_nonimage.d2:3:2: width is only applicable to image shapes.
d2/testdata/d2compiler/TestCompile/dimensions_on_nonimage.d2:4:2: height is only applicable to image shapes.
`,
},
{

View file

@ -898,17 +898,36 @@ func appendTextDedup(texts []*d2target.MText, t *d2target.MText) []*d2target.MTe
func (g *Graph) SetDimensions(mtexts []*d2target.MText, ruler *textmeasure.Ruler, fontFamily *d2fonts.FontFamily) error {
for _, obj := range g.Objects {
obj.Box = &geo.Box{}
// TODO fix edge cases for unnamed class etc
// Image shapes can set their own widths/heights
if obj.Attributes.Label.Value == "" && obj.Attributes.Shape.Value != d2target.ShapeImage {
obj.Width = 100
obj.Height = 100
continue
var setWidth int
var setHeight int
if obj.Attributes.Width != nil {
setWidth, _ = strconv.Atoi(obj.Attributes.Width.Value)
}
if obj.Attributes.Height != nil {
setHeight, _ = strconv.Atoi(obj.Attributes.Height.Value)
}
shapeType := strings.ToLower(obj.Attributes.Shape.Value)
switch shapeType {
case d2target.ShapeClass,
d2target.ShapeSQLTable,
d2target.ShapeCode,
d2target.ShapeImage,
d2target.ShapeText:
// edge cases for unnamed class, etc
default:
if obj.Attributes.Label.Value == "" && setWidth == 0 && setHeight == 0 {
obj.Width = 100
obj.Height = 100
continue
}
}
var dims *d2target.TextDimensions
var innerLabelPadding = INNER_LABEL_PADDING
if obj.Attributes.Shape.Value == d2target.ShapeText {
switch shapeType {
case d2target.ShapeText:
if obj.Attributes.Language == "latex" {
width, height, err := d2latex.Measure(obj.Text().Text)
if err != nil {
@ -925,20 +944,30 @@ func (g *Graph) SetDimensions(mtexts []*d2target.MText, ruler *textmeasure.Ruler
dims = GetTextDimensions(mtexts, ruler, obj.Text(), fontFamily)
}
innerLabelPadding = 0
} else if obj.Attributes.Shape.Value == d2target.ShapeClass {
case d2target.ShapeClass:
dims = GetTextDimensions(mtexts, ruler, obj.Text(), go2.Pointer(d2fonts.SourceCodePro))
} else {
default:
dims = GetTextDimensions(mtexts, ruler, obj.Text(), fontFamily)
}
if shapeType == d2target.ShapeSQLTable && obj.Attributes.Label.Value == "" {
// measure with placeholder text to determine height
placeholder := *obj.Text()
placeholder.Text = "Table"
dims = GetTextDimensions(mtexts, ruler, &placeholder, fontFamily)
}
if dims == nil {
if obj.Attributes.Shape.Value == d2target.ShapeImage {
if shapeType == d2target.ShapeImage {
dims = d2target.NewTextDimensions(0, 0)
} else {
return fmt.Errorf("dimensions for object label %#v not found", obj.Text())
}
}
switch obj.Attributes.Shape.Value {
switch shapeType {
case d2target.ShapeText, d2target.ShapeClass, d2target.ShapeSQLTable, d2target.ShapeCode:
// no labels
default:
@ -954,29 +983,39 @@ func (g *Graph) SetDimensions(mtexts []*d2target.MText, ruler *textmeasure.Ruler
obj.Width = float64(dims.Width)
obj.Height = float64(dims.Height)
switch strings.ToLower(obj.Attributes.Shape.Value) {
// the set dimensions must be at least as large as the text
if float64(setWidth) > obj.Width {
obj.Width = float64(setWidth)
}
if float64(setHeight) > obj.Height {
obj.Height = float64(setHeight)
}
switch shapeType {
default:
obj.Width += 100
obj.Height += 100
if setWidth == 0 {
obj.Width += 100
}
if setHeight == 0 {
obj.Height += 100
}
case d2target.ShapeImage:
if obj.Attributes.Width != nil {
w, _ := strconv.Atoi(obj.Attributes.Width.Value)
obj.Width = float64(w)
} else {
if setWidth == 0 {
obj.Width = 128
}
if obj.Attributes.Height != nil {
h, _ := strconv.Atoi(obj.Attributes.Height.Value)
obj.Height = float64(h)
} else {
if setHeight == 0 {
obj.Height = 128
}
case d2target.ShapeSquare, d2target.ShapeCircle:
sideLength := go2.Max(obj.Width, obj.Height)
obj.Width = sideLength + 100
obj.Height = sideLength + 100
padding := 0.
if setWidth == 0 && setHeight == 0 {
padding = 100.
}
obj.Width = sideLength + padding
obj.Height = sideLength + padding
case d2target.ShapeClass:
maxWidth := dims.Width
@ -1059,6 +1098,20 @@ func (g *Graph) SetDimensions(mtexts []*d2target.MText, ruler *textmeasure.Ruler
case d2target.ShapeText, d2target.ShapeCode:
}
switch shapeType {
case d2target.ShapeClass,
d2target.ShapeSQLTable,
d2target.ShapeCode,
d2target.ShapeText:
if float64(setWidth) > obj.Width {
obj.Width = float64(setWidth)
}
if float64(setHeight) > obj.Height {
obj.Height = float64(setHeight)
}
}
}
for _, edge := range g.Edges {
endpointLabels := []string{}

View file

@ -6,11 +6,11 @@
"id": "class",
"type": "class",
"pos": {
"x": 48,
"x": 0,
"y": 0
},
"width": 100,
"height": 100,
"width": 422,
"height": 368,
"opacity": 1,
"strokeDash": 0,
"strokeWidth": 2,
@ -68,8 +68,8 @@
"italic": false,
"bold": false,
"underline": false,
"labelWidth": 0,
"labelHeight": 0,
"labelWidth": 5,
"labelHeight": 5,
"zIndex": 0,
"level": 1,
"primaryAccentColor": "#0D32B2",
@ -80,11 +80,11 @@
"id": "users",
"type": "sql_table",
"pos": {
"x": 48,
"y": 200
"x": 107,
"y": 468
},
"width": 100,
"height": 100,
"width": 208,
"height": 216,
"opacity": 1,
"strokeDash": 0,
"strokeWidth": 2,
@ -112,8 +112,8 @@
"italic": false,
"bold": false,
"underline": false,
"labelWidth": 0,
"labelHeight": 0
"labelWidth": 15,
"labelHeight": 26
},
"type": {
"label": "int",
@ -124,8 +124,8 @@
"italic": false,
"bold": false,
"underline": false,
"labelWidth": 0,
"labelHeight": 0
"labelWidth": 23,
"labelHeight": 26
},
"constraint": "",
"reference": ""
@ -140,8 +140,8 @@
"italic": false,
"bold": false,
"underline": false,
"labelWidth": 0,
"labelHeight": 0
"labelWidth": 47,
"labelHeight": 26
},
"type": {
"label": "string",
@ -152,8 +152,8 @@
"italic": false,
"bold": false,
"underline": false,
"labelWidth": 0,
"labelHeight": 0
"labelWidth": 48,
"labelHeight": 26
},
"constraint": "",
"reference": ""
@ -168,8 +168,8 @@
"italic": false,
"bold": false,
"underline": false,
"labelWidth": 0,
"labelHeight": 0
"labelWidth": 47,
"labelHeight": 26
},
"type": {
"label": "string",
@ -180,8 +180,8 @@
"italic": false,
"bold": false,
"underline": false,
"labelWidth": 0,
"labelHeight": 0
"labelWidth": 48,
"labelHeight": 26
},
"constraint": "",
"reference": ""
@ -196,8 +196,8 @@
"italic": false,
"bold": false,
"underline": false,
"labelWidth": 0,
"labelHeight": 0
"labelWidth": 80,
"labelHeight": 26
},
"type": {
"label": "string",
@ -208,8 +208,8 @@
"italic": false,
"bold": false,
"underline": false,
"labelWidth": 0,
"labelHeight": 0
"labelWidth": 48,
"labelHeight": 26
},
"constraint": "",
"reference": ""
@ -224,8 +224,8 @@
"italic": false,
"bold": false,
"underline": false,
"labelWidth": 0,
"labelHeight": 0
"labelWidth": 81,
"labelHeight": 26
},
"type": {
"label": "datetime",
@ -236,8 +236,8 @@
"italic": false,
"bold": false,
"underline": false,
"labelWidth": 0,
"labelHeight": 0
"labelWidth": 77,
"labelHeight": 26
},
"constraint": "",
"reference": ""
@ -251,8 +251,8 @@
"italic": false,
"bold": true,
"underline": false,
"labelWidth": 0,
"labelHeight": 0,
"labelWidth": 64,
"labelHeight": 36,
"zIndex": 0,
"level": 1,
"primaryAccentColor": "#0D32B2",
@ -263,8 +263,8 @@
"id": "code",
"type": "code",
"pos": {
"x": 0,
"y": 400
"x": 113,
"y": 784
},
"width": 196,
"height": 70,
@ -326,20 +326,20 @@
"labelPercentage": 0,
"route": [
{
"x": 98,
"y": 100
"x": 211,
"y": 368
},
{
"x": 98,
"y": 140
"x": 211,
"y": 408
},
{
"x": 98,
"y": 160
"x": 211,
"y": 428
},
{
"x": 98,
"y": 200
"x": 211,
"y": 468
}
],
"isCurve": true,
@ -374,20 +374,20 @@
"labelPercentage": 0,
"route": [
{
"x": 98,
"y": 300
"x": 211,
"y": 684
},
{
"x": 98,
"y": 340
"x": 211,
"y": 724
},
{
"x": 98,
"y": 360
"x": 211,
"y": 744
},
{
"x": 98,
"y": 400
"x": 211,
"y": 784
}
],
"isCurve": true,

View file

@ -2,7 +2,7 @@
<svg
style="background: white;"
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
width="396" height="670" viewBox="-100 -100 396 670"><style type="text/css">
width="622" height="1054" viewBox="-100 -100 622 1054"><style type="text/css">
<![CDATA[
.shape {
shape-rendering: geometricPrecision;
@ -18,32 +18,32 @@ width="396" height="670" viewBox="-100 -100 396 670"><style type="text/css">
}
]]>
</style><g id="class"><g class="shape" ><rect class="shape" x="48" y="0" width="100" height="100" style="fill:#FFFFFF;stroke:#0A0F25;opacity:1.000000;stroke-width:2;"/><rect class="class_header" x="48.000000" y="0.000000" width="100.000000" height="25.000000" fill="#0A0F25" /><text class="text-mono" x="58.000000" y="36.250000" style="text-anchor:start;font-size:20px;fill:#0D32B2">-</text>
<text class="text-mono" x="78.000000" y="36.250000" style="text-anchor:start;font-size:20px;fill:#0A0F25">num</text>
<text class="text-mono" x="128.000000" y="36.250000" style="text-anchor:end;font-size:20px;fill:#4A6FF3">int</text><text class="text-mono" x="58.000000" y="48.750000" style="text-anchor:start;font-size:20px;fill:#0D32B2">-</text>
<text class="text-mono" x="78.000000" y="48.750000" style="text-anchor:start;font-size:20px;fill:#0A0F25">timeout</text>
<text class="text-mono" x="128.000000" y="48.750000" style="text-anchor:end;font-size:20px;fill:#4A6FF3">int</text><text class="text-mono" x="58.000000" y="61.250000" style="text-anchor:start;font-size:20px;fill:#0D32B2">-</text>
<text class="text-mono" x="78.000000" y="61.250000" style="text-anchor:start;font-size:20px;fill:#0A0F25">pid</text>
<text class="text-mono" x="128.000000" y="61.250000" style="text-anchor:end;font-size:20px;fill:#4A6FF3"></text><line x1="48.000000" y1="62.500000" x2="148.000000" y2="62.500000" style="stroke-width:1;stroke:#0A0F25" /><text class="text-mono" x="58.000000" y="73.750000" style="text-anchor:start;font-size:20px;fill:#0D32B2">+</text>
<text class="text-mono" x="78.000000" y="73.750000" style="text-anchor:start;font-size:20px;fill:#0A0F25">getStatus()</text>
<text class="text-mono" x="128.000000" y="73.750000" style="text-anchor:end;font-size:20px;fill:#4A6FF3">Enum</text><text class="text-mono" x="58.000000" y="86.250000" style="text-anchor:start;font-size:20px;fill:#0D32B2">+</text>
<text class="text-mono" x="78.000000" y="86.250000" style="text-anchor:start;font-size:20px;fill:#0A0F25">getJobs()</text>
<text class="text-mono" x="128.000000" y="86.250000" style="text-anchor:end;font-size:20px;fill:#4A6FF3">Job[]</text><text class="text-mono" x="58.000000" y="98.750000" style="text-anchor:start;font-size:20px;fill:#0D32B2">+</text>
<text class="text-mono" x="78.000000" y="98.750000" style="text-anchor:start;font-size:20px;fill:#0A0F25">setTimeout(seconds int)</text>
<text class="text-mono" x="128.000000" y="98.750000" style="text-anchor:end;font-size:20px;fill:#4A6FF3">void</text></g></g><g id="users"><g class="shape" ><rect class="shape" x="48" y="200" width="100" height="100" style="fill:#FFFFFF;stroke:#0A0F25;opacity:1.000000;stroke-width:2;"/><rect class="class_header" x="48.000000" y="200.000000" width="100.000000" height="16.666667" fill="#0A0F25" /><text class="text" x="58.000000" y="230.000000" style="text-anchor:start;font-size:20px;fill:#0D32B2">id</text>
<text class="text" x="78.000000" y="230.000000" style="text-anchor:start;font-size:20px;fill:#676C7E">int</text>
<text class="text" x="128.000000" y="230.000000" style="text-anchor:end;font-size:20px;fill:#4A6FF3;letter-spacing:2px;"></text><line x1="48.000000" y1="233.333333" x2="148.000000" y2="233.333333" style="stroke-width:2;stroke:#0A0F25" /><text class="text" x="58.000000" y="246.666667" style="text-anchor:start;font-size:20px;fill:#0D32B2">name</text>
<text class="text" x="78.000000" y="246.666667" style="text-anchor:start;font-size:20px;fill:#676C7E">string</text>
<text class="text" x="128.000000" y="246.666667" style="text-anchor:end;font-size:20px;fill:#4A6FF3;letter-spacing:2px;"></text><line x1="48.000000" y1="250.000000" x2="148.000000" y2="250.000000" style="stroke-width:2;stroke:#0A0F25" /><text class="text" x="58.000000" y="263.333333" style="text-anchor:start;font-size:20px;fill:#0D32B2">email</text>
<text class="text" x="78.000000" y="263.333333" style="text-anchor:start;font-size:20px;fill:#676C7E">string</text>
<text class="text" x="128.000000" y="263.333333" style="text-anchor:end;font-size:20px;fill:#4A6FF3;letter-spacing:2px;"></text><line x1="48.000000" y1="266.666667" x2="148.000000" y2="266.666667" style="stroke-width:2;stroke:#0A0F25" /><text class="text" x="58.000000" y="280.000000" style="text-anchor:start;font-size:20px;fill:#0D32B2">password</text>
<text class="text" x="78.000000" y="280.000000" style="text-anchor:start;font-size:20px;fill:#676C7E">string</text>
<text class="text" x="128.000000" y="280.000000" style="text-anchor:end;font-size:20px;fill:#4A6FF3;letter-spacing:2px;"></text><line x1="48.000000" y1="283.333333" x2="148.000000" y2="283.333333" style="stroke-width:2;stroke:#0A0F25" /><text class="text" x="58.000000" y="296.666667" style="text-anchor:start;font-size:20px;fill:#0D32B2">last_login</text>
<text class="text" x="78.000000" y="296.666667" style="text-anchor:start;font-size:20px;fill:#676C7E">datetime</text>
<text class="text" x="128.000000" y="296.666667" style="text-anchor:end;font-size:20px;fill:#4A6FF3;letter-spacing:2px;"></text><line x1="48.000000" y1="300.000000" x2="148.000000" y2="300.000000" style="stroke-width:2;stroke:#0A0F25" /></g></g><g id="code"><g class="shape" ></g><g transform="translate(0.000000 400.000000)" style="opacity:1.000000"><rect class="shape" width="196" height="70" style="stroke: #0A0F25;fill:#ffffff" /><g transform="translate(6 6)"><text class="text-mono" x="0" y="1.000000em" xml:space="preserve">a&#160;<tspan fill="#000000" font-weight="bold">:=</tspan>&#160;<tspan fill="#009999">5</tspan>
</style><g id="class"><g class="shape" ><rect class="shape" x="0" y="0" width="422" height="368" style="fill:#FFFFFF;stroke:#0A0F25;opacity:1.000000;stroke-width:2;"/><rect class="class_header" x="0.000000" y="0.000000" width="422.000000" height="92.000000" fill="#0A0F25" /><text class="text-mono" x="10.000000" y="120.000000" style="text-anchor:start;font-size:20px;fill:#0D32B2">-</text>
<text class="text-mono" x="30.000000" y="120.000000" style="text-anchor:start;font-size:20px;fill:#0A0F25">num</text>
<text class="text-mono" x="402.000000" y="120.000000" style="text-anchor:end;font-size:20px;fill:#4A6FF3">int</text><text class="text-mono" x="10.000000" y="166.000000" style="text-anchor:start;font-size:20px;fill:#0D32B2">-</text>
<text class="text-mono" x="30.000000" y="166.000000" style="text-anchor:start;font-size:20px;fill:#0A0F25">timeout</text>
<text class="text-mono" x="402.000000" y="166.000000" style="text-anchor:end;font-size:20px;fill:#4A6FF3">int</text><text class="text-mono" x="10.000000" y="212.000000" style="text-anchor:start;font-size:20px;fill:#0D32B2">-</text>
<text class="text-mono" x="30.000000" y="212.000000" style="text-anchor:start;font-size:20px;fill:#0A0F25">pid</text>
<text class="text-mono" x="402.000000" y="212.000000" style="text-anchor:end;font-size:20px;fill:#4A6FF3"></text><line x1="0.000000" y1="230.000000" x2="422.000000" y2="230.000000" style="stroke-width:1;stroke:#0A0F25" /><text class="text-mono" x="10.000000" y="258.000000" style="text-anchor:start;font-size:20px;fill:#0D32B2">+</text>
<text class="text-mono" x="30.000000" y="258.000000" style="text-anchor:start;font-size:20px;fill:#0A0F25">getStatus()</text>
<text class="text-mono" x="402.000000" y="258.000000" style="text-anchor:end;font-size:20px;fill:#4A6FF3">Enum</text><text class="text-mono" x="10.000000" y="304.000000" style="text-anchor:start;font-size:20px;fill:#0D32B2">+</text>
<text class="text-mono" x="30.000000" y="304.000000" style="text-anchor:start;font-size:20px;fill:#0A0F25">getJobs()</text>
<text class="text-mono" x="402.000000" y="304.000000" style="text-anchor:end;font-size:20px;fill:#4A6FF3">Job[]</text><text class="text-mono" x="10.000000" y="350.000000" style="text-anchor:start;font-size:20px;fill:#0D32B2">+</text>
<text class="text-mono" x="30.000000" y="350.000000" style="text-anchor:start;font-size:20px;fill:#0A0F25">setTimeout(seconds int)</text>
<text class="text-mono" x="402.000000" y="350.000000" style="text-anchor:end;font-size:20px;fill:#4A6FF3">void</text></g></g><g id="users"><g class="shape" ><rect class="shape" x="107" y="468" width="208" height="216" style="fill:#FFFFFF;stroke:#0A0F25;opacity:1.000000;stroke-width:2;"/><rect class="class_header" x="107.000000" y="468.000000" width="208.000000" height="36.000000" fill="#0A0F25" /><text class="text" x="117.000000" y="527.000000" style="text-anchor:start;font-size:20px;fill:#0D32B2">id</text>
<text class="text" x="218.000000" y="527.000000" style="text-anchor:start;font-size:20px;fill:#676C7E">int</text>
<text class="text" x="295.000000" y="527.000000" style="text-anchor:end;font-size:20px;fill:#4A6FF3;letter-spacing:2px;"></text><line x1="107.000000" y1="540.000000" x2="315.000000" y2="540.000000" style="stroke-width:2;stroke:#0A0F25" /><text class="text" x="117.000000" y="563.000000" style="text-anchor:start;font-size:20px;fill:#0D32B2">name</text>
<text class="text" x="218.000000" y="563.000000" style="text-anchor:start;font-size:20px;fill:#676C7E">string</text>
<text class="text" x="295.000000" y="563.000000" style="text-anchor:end;font-size:20px;fill:#4A6FF3;letter-spacing:2px;"></text><line x1="107.000000" y1="576.000000" x2="315.000000" y2="576.000000" style="stroke-width:2;stroke:#0A0F25" /><text class="text" x="117.000000" y="599.000000" style="text-anchor:start;font-size:20px;fill:#0D32B2">email</text>
<text class="text" x="218.000000" y="599.000000" style="text-anchor:start;font-size:20px;fill:#676C7E">string</text>
<text class="text" x="295.000000" y="599.000000" style="text-anchor:end;font-size:20px;fill:#4A6FF3;letter-spacing:2px;"></text><line x1="107.000000" y1="612.000000" x2="315.000000" y2="612.000000" style="stroke-width:2;stroke:#0A0F25" /><text class="text" x="117.000000" y="635.000000" style="text-anchor:start;font-size:20px;fill:#0D32B2">password</text>
<text class="text" x="218.000000" y="635.000000" style="text-anchor:start;font-size:20px;fill:#676C7E">string</text>
<text class="text" x="295.000000" y="635.000000" style="text-anchor:end;font-size:20px;fill:#4A6FF3;letter-spacing:2px;"></text><line x1="107.000000" y1="648.000000" x2="315.000000" y2="648.000000" style="stroke-width:2;stroke:#0A0F25" /><text class="text" x="117.000000" y="671.000000" style="text-anchor:start;font-size:20px;fill:#0D32B2">last_login</text>
<text class="text" x="218.000000" y="671.000000" style="text-anchor:start;font-size:20px;fill:#676C7E">datetime</text>
<text class="text" x="295.000000" y="671.000000" style="text-anchor:end;font-size:20px;fill:#4A6FF3;letter-spacing:2px;"></text><line x1="107.000000" y1="684.000000" x2="315.000000" y2="684.000000" style="stroke-width:2;stroke:#0A0F25" /></g></g><g id="code"><g class="shape" ></g><g transform="translate(113.000000 784.000000)" style="opacity:1.000000"><rect class="shape" width="196" height="70" style="stroke: #0A0F25;fill:#ffffff" /><g transform="translate(6 6)"><text class="text-mono" x="0" y="1.000000em" xml:space="preserve">a&#160;<tspan fill="#000000" font-weight="bold">:=</tspan>&#160;<tspan fill="#009999">5</tspan>
</text><text class="text-mono" x="0" y="2.000000em" xml:space="preserve">b&#160;<tspan fill="#000000" font-weight="bold">:=</tspan>&#160;a&#160;<tspan fill="#000000" font-weight="bold">+</tspan>&#160;<tspan fill="#009999">7</tspan>
</text><text class="text-mono" x="0" y="3.000000em" xml:space="preserve">fmt.<tspan fill="#990000" font-weight="bold">Printf</tspan>(<tspan fill="#dd1144">&quot;%d&quot;</tspan>,&#160;b)</text></g></g></g><g id="(class -&gt; users)[0]"><marker id="mk-3990223579" markerWidth="10.000000" markerHeight="12.000000" refX="7.000000" refY="6.000000" viewBox="0.000000 0.000000 10.000000 12.000000" orient="auto" markerUnits="userSpaceOnUse"> <polygon class="connection" fill="#0D32B2" stroke-width="2" points="0.000000,0.000000 10.000000,6.000000 0.000000,12.000000" /> </marker><path d="M 98.000000 102.000000 C 98.000000 140.000000 98.000000 160.000000 98.000000 196.000000" class="connection" style="fill:none;stroke:#0D32B2;opacity:1.000000;stroke-width:2;" marker-end="url(#mk-3990223579)" mask="url(#2425301786)"/></g><g id="(users -&gt; code)[0]"><path d="M 98.000000 302.000000 C 98.000000 340.000000 98.000000 360.000000 98.000000 396.000000" class="connection" style="fill:none;stroke:#0D32B2;opacity:1.000000;stroke-width:2;" marker-end="url(#mk-3990223579)" mask="url(#2425301786)"/></g><mask id="2425301786" maskUnits="userSpaceOnUse" x="-100" y="-100" width="396" height="670">
<rect x="-100" y="-100" width="396" height="670" fill="white"></rect>
</text><text class="text-mono" x="0" y="3.000000em" xml:space="preserve">fmt.<tspan fill="#990000" font-weight="bold">Printf</tspan>(<tspan fill="#dd1144">&quot;%d&quot;</tspan>,&#160;b)</text></g></g></g><g id="(class -&gt; users)[0]"><marker id="mk-3990223579" markerWidth="10.000000" markerHeight="12.000000" refX="7.000000" refY="6.000000" viewBox="0.000000 0.000000 10.000000 12.000000" orient="auto" markerUnits="userSpaceOnUse"> <polygon class="connection" fill="#0D32B2" stroke-width="2" points="0.000000,0.000000 10.000000,6.000000 0.000000,12.000000" /> </marker><path d="M 211.000000 370.000000 C 211.000000 408.000000 211.000000 428.000000 211.000000 464.000000" class="connection" style="fill:none;stroke:#0D32B2;opacity:1.000000;stroke-width:2;" marker-end="url(#mk-3990223579)" mask="url(#3594194739)"/></g><g id="(users -&gt; code)[0]"><path d="M 211.000000 686.000000 C 211.000000 724.000000 211.000000 744.000000 211.000000 780.000000" class="connection" style="fill:none;stroke:#0D32B2;opacity:1.000000;stroke-width:2;" marker-end="url(#mk-3990223579)" mask="url(#3594194739)"/></g><mask id="3594194739" maskUnits="userSpaceOnUse" x="-100" y="-100" width="622" height="1054">
<rect x="-100" y="-100" width="622" height="1054" fill="white"></rect>
</mask><style type="text/css"><![CDATA[
.text {

Before

Width:  |  Height:  |  Size: 512 KiB

After

Width:  |  Height:  |  Size: 512 KiB

View file

@ -6,11 +6,11 @@
"id": "class",
"type": "class",
"pos": {
"x": 60,
"x": 12,
"y": 12
},
"width": 100,
"height": 100,
"width": 422,
"height": 368,
"opacity": 1,
"strokeDash": 0,
"strokeWidth": 2,
@ -68,8 +68,8 @@
"italic": false,
"bold": false,
"underline": false,
"labelWidth": 0,
"labelHeight": 0,
"labelWidth": 5,
"labelHeight": 5,
"zIndex": 0,
"level": 1,
"primaryAccentColor": "#0D32B2",
@ -80,11 +80,11 @@
"id": "users",
"type": "sql_table",
"pos": {
"x": 60,
"y": 212
"x": 119,
"y": 480
},
"width": 100,
"height": 100,
"width": 208,
"height": 216,
"opacity": 1,
"strokeDash": 0,
"strokeWidth": 2,
@ -112,8 +112,8 @@
"italic": false,
"bold": false,
"underline": false,
"labelWidth": 0,
"labelHeight": 0
"labelWidth": 15,
"labelHeight": 26
},
"type": {
"label": "int",
@ -124,8 +124,8 @@
"italic": false,
"bold": false,
"underline": false,
"labelWidth": 0,
"labelHeight": 0
"labelWidth": 23,
"labelHeight": 26
},
"constraint": "",
"reference": ""
@ -140,8 +140,8 @@
"italic": false,
"bold": false,
"underline": false,
"labelWidth": 0,
"labelHeight": 0
"labelWidth": 47,
"labelHeight": 26
},
"type": {
"label": "string",
@ -152,8 +152,8 @@
"italic": false,
"bold": false,
"underline": false,
"labelWidth": 0,
"labelHeight": 0
"labelWidth": 48,
"labelHeight": 26
},
"constraint": "",
"reference": ""
@ -168,8 +168,8 @@
"italic": false,
"bold": false,
"underline": false,
"labelWidth": 0,
"labelHeight": 0
"labelWidth": 47,
"labelHeight": 26
},
"type": {
"label": "string",
@ -180,8 +180,8 @@
"italic": false,
"bold": false,
"underline": false,
"labelWidth": 0,
"labelHeight": 0
"labelWidth": 48,
"labelHeight": 26
},
"constraint": "",
"reference": ""
@ -196,8 +196,8 @@
"italic": false,
"bold": false,
"underline": false,
"labelWidth": 0,
"labelHeight": 0
"labelWidth": 80,
"labelHeight": 26
},
"type": {
"label": "string",
@ -208,8 +208,8 @@
"italic": false,
"bold": false,
"underline": false,
"labelWidth": 0,
"labelHeight": 0
"labelWidth": 48,
"labelHeight": 26
},
"constraint": "",
"reference": ""
@ -224,8 +224,8 @@
"italic": false,
"bold": false,
"underline": false,
"labelWidth": 0,
"labelHeight": 0
"labelWidth": 81,
"labelHeight": 26
},
"type": {
"label": "datetime",
@ -236,8 +236,8 @@
"italic": false,
"bold": false,
"underline": false,
"labelWidth": 0,
"labelHeight": 0
"labelWidth": 77,
"labelHeight": 26
},
"constraint": "",
"reference": ""
@ -251,8 +251,8 @@
"italic": false,
"bold": true,
"underline": false,
"labelWidth": 0,
"labelHeight": 0,
"labelWidth": 64,
"labelHeight": 36,
"zIndex": 0,
"level": 1,
"primaryAccentColor": "#0D32B2",
@ -263,8 +263,8 @@
"id": "code",
"type": "code",
"pos": {
"x": 12,
"y": 412
"x": 125,
"y": 796
},
"width": 196,
"height": 70,
@ -326,12 +326,12 @@
"labelPercentage": 0,
"route": [
{
"x": 110,
"y": 112
"x": 223,
"y": 380
},
{
"x": 110,
"y": 212
"x": 223,
"y": 480
}
],
"animated": false,
@ -365,12 +365,12 @@
"labelPercentage": 0,
"route": [
{
"x": 110,
"y": 312
"x": 223,
"y": 696
},
{
"x": 110,
"y": 412
"x": 223,
"y": 796
}
],
"animated": false,

View file

@ -2,7 +2,7 @@
<svg
style="background: white;"
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
width="396" height="670" viewBox="-88 -88 396 670"><style type="text/css">
width="622" height="1054" viewBox="-88 -88 622 1054"><style type="text/css">
<![CDATA[
.shape {
shape-rendering: geometricPrecision;
@ -18,32 +18,32 @@ width="396" height="670" viewBox="-88 -88 396 670"><style type="text/css">
}
]]>
</style><g id="class"><g class="shape" ><rect class="shape" x="60" y="12" width="100" height="100" style="fill:#FFFFFF;stroke:#0A0F25;opacity:1.000000;stroke-width:2;"/><rect class="class_header" x="60.000000" y="12.000000" width="100.000000" height="25.000000" fill="#0A0F25" /><text class="text-mono" x="70.000000" y="48.250000" style="text-anchor:start;font-size:20px;fill:#0D32B2">-</text>
<text class="text-mono" x="90.000000" y="48.250000" style="text-anchor:start;font-size:20px;fill:#0A0F25">num</text>
<text class="text-mono" x="140.000000" y="48.250000" style="text-anchor:end;font-size:20px;fill:#4A6FF3">int</text><text class="text-mono" x="70.000000" y="60.750000" style="text-anchor:start;font-size:20px;fill:#0D32B2">-</text>
<text class="text-mono" x="90.000000" y="60.750000" style="text-anchor:start;font-size:20px;fill:#0A0F25">timeout</text>
<text class="text-mono" x="140.000000" y="60.750000" style="text-anchor:end;font-size:20px;fill:#4A6FF3">int</text><text class="text-mono" x="70.000000" y="73.250000" style="text-anchor:start;font-size:20px;fill:#0D32B2">-</text>
<text class="text-mono" x="90.000000" y="73.250000" style="text-anchor:start;font-size:20px;fill:#0A0F25">pid</text>
<text class="text-mono" x="140.000000" y="73.250000" style="text-anchor:end;font-size:20px;fill:#4A6FF3"></text><line x1="60.000000" y1="74.500000" x2="160.000000" y2="74.500000" style="stroke-width:1;stroke:#0A0F25" /><text class="text-mono" x="70.000000" y="85.750000" style="text-anchor:start;font-size:20px;fill:#0D32B2">+</text>
<text class="text-mono" x="90.000000" y="85.750000" style="text-anchor:start;font-size:20px;fill:#0A0F25">getStatus()</text>
<text class="text-mono" x="140.000000" y="85.750000" style="text-anchor:end;font-size:20px;fill:#4A6FF3">Enum</text><text class="text-mono" x="70.000000" y="98.250000" style="text-anchor:start;font-size:20px;fill:#0D32B2">+</text>
<text class="text-mono" x="90.000000" y="98.250000" style="text-anchor:start;font-size:20px;fill:#0A0F25">getJobs()</text>
<text class="text-mono" x="140.000000" y="98.250000" style="text-anchor:end;font-size:20px;fill:#4A6FF3">Job[]</text><text class="text-mono" x="70.000000" y="110.750000" style="text-anchor:start;font-size:20px;fill:#0D32B2">+</text>
<text class="text-mono" x="90.000000" y="110.750000" style="text-anchor:start;font-size:20px;fill:#0A0F25">setTimeout(seconds int)</text>
<text class="text-mono" x="140.000000" y="110.750000" style="text-anchor:end;font-size:20px;fill:#4A6FF3">void</text></g></g><g id="users"><g class="shape" ><rect class="shape" x="60" y="212" width="100" height="100" style="fill:#FFFFFF;stroke:#0A0F25;opacity:1.000000;stroke-width:2;"/><rect class="class_header" x="60.000000" y="212.000000" width="100.000000" height="16.666667" fill="#0A0F25" /><text class="text" x="70.000000" y="242.000000" style="text-anchor:start;font-size:20px;fill:#0D32B2">id</text>
<text class="text" x="90.000000" y="242.000000" style="text-anchor:start;font-size:20px;fill:#676C7E">int</text>
<text class="text" x="140.000000" y="242.000000" style="text-anchor:end;font-size:20px;fill:#4A6FF3;letter-spacing:2px;"></text><line x1="60.000000" y1="245.333333" x2="160.000000" y2="245.333333" style="stroke-width:2;stroke:#0A0F25" /><text class="text" x="70.000000" y="258.666667" style="text-anchor:start;font-size:20px;fill:#0D32B2">name</text>
<text class="text" x="90.000000" y="258.666667" style="text-anchor:start;font-size:20px;fill:#676C7E">string</text>
<text class="text" x="140.000000" y="258.666667" style="text-anchor:end;font-size:20px;fill:#4A6FF3;letter-spacing:2px;"></text><line x1="60.000000" y1="262.000000" x2="160.000000" y2="262.000000" style="stroke-width:2;stroke:#0A0F25" /><text class="text" x="70.000000" y="275.333333" style="text-anchor:start;font-size:20px;fill:#0D32B2">email</text>
<text class="text" x="90.000000" y="275.333333" style="text-anchor:start;font-size:20px;fill:#676C7E">string</text>
<text class="text" x="140.000000" y="275.333333" style="text-anchor:end;font-size:20px;fill:#4A6FF3;letter-spacing:2px;"></text><line x1="60.000000" y1="278.666667" x2="160.000000" y2="278.666667" style="stroke-width:2;stroke:#0A0F25" /><text class="text" x="70.000000" y="292.000000" style="text-anchor:start;font-size:20px;fill:#0D32B2">password</text>
<text class="text" x="90.000000" y="292.000000" style="text-anchor:start;font-size:20px;fill:#676C7E">string</text>
<text class="text" x="140.000000" y="292.000000" style="text-anchor:end;font-size:20px;fill:#4A6FF3;letter-spacing:2px;"></text><line x1="60.000000" y1="295.333333" x2="160.000000" y2="295.333333" style="stroke-width:2;stroke:#0A0F25" /><text class="text" x="70.000000" y="308.666667" style="text-anchor:start;font-size:20px;fill:#0D32B2">last_login</text>
<text class="text" x="90.000000" y="308.666667" style="text-anchor:start;font-size:20px;fill:#676C7E">datetime</text>
<text class="text" x="140.000000" y="308.666667" style="text-anchor:end;font-size:20px;fill:#4A6FF3;letter-spacing:2px;"></text><line x1="60.000000" y1="312.000000" x2="160.000000" y2="312.000000" style="stroke-width:2;stroke:#0A0F25" /></g></g><g id="code"><g class="shape" ></g><g transform="translate(12.000000 412.000000)" style="opacity:1.000000"><rect class="shape" width="196" height="70" style="stroke: #0A0F25;fill:#ffffff" /><g transform="translate(6 6)"><text class="text-mono" x="0" y="1.000000em" xml:space="preserve">a&#160;<tspan fill="#000000" font-weight="bold">:=</tspan>&#160;<tspan fill="#009999">5</tspan>
</style><g id="class"><g class="shape" ><rect class="shape" x="12" y="12" width="422" height="368" style="fill:#FFFFFF;stroke:#0A0F25;opacity:1.000000;stroke-width:2;"/><rect class="class_header" x="12.000000" y="12.000000" width="422.000000" height="92.000000" fill="#0A0F25" /><text class="text-mono" x="22.000000" y="132.000000" style="text-anchor:start;font-size:20px;fill:#0D32B2">-</text>
<text class="text-mono" x="42.000000" y="132.000000" style="text-anchor:start;font-size:20px;fill:#0A0F25">num</text>
<text class="text-mono" x="414.000000" y="132.000000" style="text-anchor:end;font-size:20px;fill:#4A6FF3">int</text><text class="text-mono" x="22.000000" y="178.000000" style="text-anchor:start;font-size:20px;fill:#0D32B2">-</text>
<text class="text-mono" x="42.000000" y="178.000000" style="text-anchor:start;font-size:20px;fill:#0A0F25">timeout</text>
<text class="text-mono" x="414.000000" y="178.000000" style="text-anchor:end;font-size:20px;fill:#4A6FF3">int</text><text class="text-mono" x="22.000000" y="224.000000" style="text-anchor:start;font-size:20px;fill:#0D32B2">-</text>
<text class="text-mono" x="42.000000" y="224.000000" style="text-anchor:start;font-size:20px;fill:#0A0F25">pid</text>
<text class="text-mono" x="414.000000" y="224.000000" style="text-anchor:end;font-size:20px;fill:#4A6FF3"></text><line x1="12.000000" y1="242.000000" x2="434.000000" y2="242.000000" style="stroke-width:1;stroke:#0A0F25" /><text class="text-mono" x="22.000000" y="270.000000" style="text-anchor:start;font-size:20px;fill:#0D32B2">+</text>
<text class="text-mono" x="42.000000" y="270.000000" style="text-anchor:start;font-size:20px;fill:#0A0F25">getStatus()</text>
<text class="text-mono" x="414.000000" y="270.000000" style="text-anchor:end;font-size:20px;fill:#4A6FF3">Enum</text><text class="text-mono" x="22.000000" y="316.000000" style="text-anchor:start;font-size:20px;fill:#0D32B2">+</text>
<text class="text-mono" x="42.000000" y="316.000000" style="text-anchor:start;font-size:20px;fill:#0A0F25">getJobs()</text>
<text class="text-mono" x="414.000000" y="316.000000" style="text-anchor:end;font-size:20px;fill:#4A6FF3">Job[]</text><text class="text-mono" x="22.000000" y="362.000000" style="text-anchor:start;font-size:20px;fill:#0D32B2">+</text>
<text class="text-mono" x="42.000000" y="362.000000" style="text-anchor:start;font-size:20px;fill:#0A0F25">setTimeout(seconds int)</text>
<text class="text-mono" x="414.000000" y="362.000000" style="text-anchor:end;font-size:20px;fill:#4A6FF3">void</text></g></g><g id="users"><g class="shape" ><rect class="shape" x="119" y="480" width="208" height="216" style="fill:#FFFFFF;stroke:#0A0F25;opacity:1.000000;stroke-width:2;"/><rect class="class_header" x="119.000000" y="480.000000" width="208.000000" height="36.000000" fill="#0A0F25" /><text class="text" x="129.000000" y="539.000000" style="text-anchor:start;font-size:20px;fill:#0D32B2">id</text>
<text class="text" x="230.000000" y="539.000000" style="text-anchor:start;font-size:20px;fill:#676C7E">int</text>
<text class="text" x="307.000000" y="539.000000" style="text-anchor:end;font-size:20px;fill:#4A6FF3;letter-spacing:2px;"></text><line x1="119.000000" y1="552.000000" x2="327.000000" y2="552.000000" style="stroke-width:2;stroke:#0A0F25" /><text class="text" x="129.000000" y="575.000000" style="text-anchor:start;font-size:20px;fill:#0D32B2">name</text>
<text class="text" x="230.000000" y="575.000000" style="text-anchor:start;font-size:20px;fill:#676C7E">string</text>
<text class="text" x="307.000000" y="575.000000" style="text-anchor:end;font-size:20px;fill:#4A6FF3;letter-spacing:2px;"></text><line x1="119.000000" y1="588.000000" x2="327.000000" y2="588.000000" style="stroke-width:2;stroke:#0A0F25" /><text class="text" x="129.000000" y="611.000000" style="text-anchor:start;font-size:20px;fill:#0D32B2">email</text>
<text class="text" x="230.000000" y="611.000000" style="text-anchor:start;font-size:20px;fill:#676C7E">string</text>
<text class="text" x="307.000000" y="611.000000" style="text-anchor:end;font-size:20px;fill:#4A6FF3;letter-spacing:2px;"></text><line x1="119.000000" y1="624.000000" x2="327.000000" y2="624.000000" style="stroke-width:2;stroke:#0A0F25" /><text class="text" x="129.000000" y="647.000000" style="text-anchor:start;font-size:20px;fill:#0D32B2">password</text>
<text class="text" x="230.000000" y="647.000000" style="text-anchor:start;font-size:20px;fill:#676C7E">string</text>
<text class="text" x="307.000000" y="647.000000" style="text-anchor:end;font-size:20px;fill:#4A6FF3;letter-spacing:2px;"></text><line x1="119.000000" y1="660.000000" x2="327.000000" y2="660.000000" style="stroke-width:2;stroke:#0A0F25" /><text class="text" x="129.000000" y="683.000000" style="text-anchor:start;font-size:20px;fill:#0D32B2">last_login</text>
<text class="text" x="230.000000" y="683.000000" style="text-anchor:start;font-size:20px;fill:#676C7E">datetime</text>
<text class="text" x="307.000000" y="683.000000" style="text-anchor:end;font-size:20px;fill:#4A6FF3;letter-spacing:2px;"></text><line x1="119.000000" y1="696.000000" x2="327.000000" y2="696.000000" style="stroke-width:2;stroke:#0A0F25" /></g></g><g id="code"><g class="shape" ></g><g transform="translate(125.000000 796.000000)" style="opacity:1.000000"><rect class="shape" width="196" height="70" style="stroke: #0A0F25;fill:#ffffff" /><g transform="translate(6 6)"><text class="text-mono" x="0" y="1.000000em" xml:space="preserve">a&#160;<tspan fill="#000000" font-weight="bold">:=</tspan>&#160;<tspan fill="#009999">5</tspan>
</text><text class="text-mono" x="0" y="2.000000em" xml:space="preserve">b&#160;<tspan fill="#000000" font-weight="bold">:=</tspan>&#160;a&#160;<tspan fill="#000000" font-weight="bold">+</tspan>&#160;<tspan fill="#009999">7</tspan>
</text><text class="text-mono" x="0" y="3.000000em" xml:space="preserve">fmt.<tspan fill="#990000" font-weight="bold">Printf</tspan>(<tspan fill="#dd1144">&quot;%d&quot;</tspan>,&#160;b)</text></g></g></g><g id="(class -&gt; users)[0]"><marker id="mk-3990223579" markerWidth="10.000000" markerHeight="12.000000" refX="7.000000" refY="6.000000" viewBox="0.000000 0.000000 10.000000 12.000000" orient="auto" markerUnits="userSpaceOnUse"> <polygon class="connection" fill="#0D32B2" stroke-width="2" points="0.000000,0.000000 10.000000,6.000000 0.000000,12.000000" /> </marker><path d="M 110.000000 114.000000 L 110.000000 208.000000" class="connection" style="fill:none;stroke:#0D32B2;opacity:1.000000;stroke-width:2;" marker-end="url(#mk-3990223579)" mask="url(#1185608436)"/></g><g id="(users -&gt; code)[0]"><path d="M 110.000000 314.000000 L 110.000000 408.000000" class="connection" style="fill:none;stroke:#0D32B2;opacity:1.000000;stroke-width:2;" marker-end="url(#mk-3990223579)" mask="url(#1185608436)"/></g><mask id="1185608436" maskUnits="userSpaceOnUse" x="-100" y="-100" width="396" height="670">
<rect x="-100" y="-100" width="396" height="670" fill="white"></rect>
</text><text class="text-mono" x="0" y="3.000000em" xml:space="preserve">fmt.<tspan fill="#990000" font-weight="bold">Printf</tspan>(<tspan fill="#dd1144">&quot;%d&quot;</tspan>,&#160;b)</text></g></g></g><g id="(class -&gt; users)[0]"><marker id="mk-3990223579" markerWidth="10.000000" markerHeight="12.000000" refX="7.000000" refY="6.000000" viewBox="0.000000 0.000000 10.000000 12.000000" orient="auto" markerUnits="userSpaceOnUse"> <polygon class="connection" fill="#0D32B2" stroke-width="2" points="0.000000,0.000000 10.000000,6.000000 0.000000,12.000000" /> </marker><path d="M 223.000000 382.000000 L 223.000000 476.000000" class="connection" style="fill:none;stroke:#0D32B2;opacity:1.000000;stroke-width:2;" marker-end="url(#mk-3990223579)" mask="url(#1349387874)"/></g><g id="(users -&gt; code)[0]"><path d="M 223.000000 698.000000 L 223.000000 792.000000" class="connection" style="fill:none;stroke:#0D32B2;opacity:1.000000;stroke-width:2;" marker-end="url(#mk-3990223579)" mask="url(#1349387874)"/></g><mask id="1349387874" maskUnits="userSpaceOnUse" x="-100" y="-100" width="622" height="1054">
<rect x="-100" y="-100" width="622" height="1054" fill="white"></rect>
</mask><style type="text/css"><![CDATA[
.text {

Before

Width:  |  Height:  |  Size: 512 KiB

After

Width:  |  Height:  |  Size: 512 KiB

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 842 KiB

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 842 KiB

View file

@ -1,16 +1,210 @@
{
"graph": null,
"err": {
"ioerr": null,
"errs": [
{
"range": "d2/testdata/d2compiler/TestCompile/dimensions_on_nonimage.d2,2:1:28-2:11:38",
"errmsg": "d2/testdata/d2compiler/TestCompile/dimensions_on_nonimage.d2:3:2: width is only applicable to image shapes."
"graph": {
"ast": {
"range": "d2/testdata/d2compiler/TestCompile/dimensions_on_nonimage.d2,0:0:0-5:0:54",
"nodes": [
{
"map_key": {
"range": "d2/testdata/d2compiler/TestCompile/dimensions_on_nonimage.d2,0:0:0-4:1:53",
"key": {
"range": "d2/testdata/d2compiler/TestCompile/dimensions_on_nonimage.d2,0:0:0-0:3:3",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/dimensions_on_nonimage.d2,0:0:0-0:3:3",
"value": [
{
"string": "hey",
"raw_string": "hey"
}
]
}
}
]
},
"primary": {
"double_quoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/dimensions_on_nonimage.d2,0:5:5-0:7:7",
"value": null
}
},
"value": {
"map": {
"range": "d2/testdata/d2compiler/TestCompile/dimensions_on_nonimage.d2,0:8:8-4:0:52",
"nodes": [
{
"map_key": {
"range": "d2/testdata/d2compiler/TestCompile/dimensions_on_nonimage.d2,1:2:12-1:16:26",
"key": {
"range": "d2/testdata/d2compiler/TestCompile/dimensions_on_nonimage.d2,1:2:12-1:7:17",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/dimensions_on_nonimage.d2,1:2:12-1:7:17",
"value": [
{
"string": "shape",
"raw_string": "shape"
}
]
}
}
]
},
"primary": {},
"value": {
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/dimensions_on_nonimage.d2,1:9:19-1:16:26",
"value": [
{
"string": "hexagon",
"raw_string": "hexagon"
}
]
}
}
}
},
{
"map_key": {
"range": "d2/testdata/d2compiler/TestCompile/dimensions_on_nonimage.d2,2:1:28-2:11:38",
"key": {
"range": "d2/testdata/d2compiler/TestCompile/dimensions_on_nonimage.d2,2:1:28-2:6:33",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/dimensions_on_nonimage.d2,2:1:28-2:6:33",
"value": [
{
"string": "width",
"raw_string": "width"
}
]
}
}
]
},
"primary": {},
"value": {
"number": {
"range": "d2/testdata/d2compiler/TestCompile/dimensions_on_nonimage.d2,2:8:35-2:11:38",
"raw": "200",
"value": "200"
}
}
}
},
{
"map_key": {
"range": "d2/testdata/d2compiler/TestCompile/dimensions_on_nonimage.d2,3:1:40-3:12:51",
"key": {
"range": "d2/testdata/d2compiler/TestCompile/dimensions_on_nonimage.d2,3:1:40-3:7:46",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/dimensions_on_nonimage.d2,3:1:40-3:7:46",
"value": [
{
"string": "height",
"raw_string": "height"
}
]
}
}
]
},
"primary": {},
"value": {
"number": {
"range": "d2/testdata/d2compiler/TestCompile/dimensions_on_nonimage.d2,3:9:48-3:12:51",
"raw": "230",
"value": "230"
}
}
}
}
]
}
}
}
}
]
},
"root": {
"id": "",
"id_val": "",
"label_dimensions": {
"width": 0,
"height": 0
},
"attributes": {
"label": {
"value": ""
},
"style": {},
"near_key": null,
"shape": {
"value": ""
},
"direction": {
"value": ""
}
},
"zIndex": 0
},
"edges": null,
"objects": [
{
"range": "d2/testdata/d2compiler/TestCompile/dimensions_on_nonimage.d2,3:1:40-3:12:51",
"errmsg": "d2/testdata/d2compiler/TestCompile/dimensions_on_nonimage.d2:4:2: height is only applicable to image shapes."
"id": "hey",
"id_val": "hey",
"label_dimensions": {
"width": 0,
"height": 0
},
"references": [
{
"key": {
"range": "d2/testdata/d2compiler/TestCompile/dimensions_on_nonimage.d2,0:0:0-0:3:3",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/dimensions_on_nonimage.d2,0:0:0-0:3:3",
"value": [
{
"string": "hey",
"raw_string": "hey"
}
]
}
}
]
},
"key_path_index": 0,
"map_key_edge_index": 0
}
],
"attributes": {
"label": {
"value": ""
},
"style": {},
"width": {
"value": "200"
},
"height": {
"value": "230"
},
"near_key": null,
"shape": {
"value": "hexagon"
},
"direction": {
"value": ""
}
},
"zIndex": 0
}
]
}
},
"err": null
}