From b0d3b9d3fdb302647a6b550095a4faa75e67559b Mon Sep 17 00:00:00 2001 From: Paracelsus-Rose Date: Mon, 9 Jan 2023 22:44:45 -0500 Subject: [PATCH 01/19] Init --- ci/release/changelogs/next.md | 2 +- d2renderers/d2svg/d2svg.go | 47 +++++++++++++++++++++++++++++++++++ d2target/d2target.go | 9 +++++++ e2etests/stable_test.go | 23 +++++++++++++++++ 4 files changed, 80 insertions(+), 1 deletion(-) diff --git a/ci/release/changelogs/next.md b/ci/release/changelogs/next.md index f3c0d2a77..955808118 100644 --- a/ci/release/changelogs/next.md +++ b/ci/release/changelogs/next.md @@ -1,5 +1,5 @@ #### Features ๐Ÿš€ - +- Circle notation is now supported. [] #### Improvements ๐Ÿงน #### Bugfixes โ›‘๏ธ diff --git a/d2renderers/d2svg/d2svg.go b/d2renderers/d2svg/d2svg.go index 678f0c2ae..91b18c54a 100644 --- a/d2renderers/d2svg/d2svg.go +++ b/d2renderers/d2svg/d2svg.go @@ -114,6 +114,12 @@ func arrowheadDimensions(arrowhead d2target.Arrowhead, strokeWidth float64) (wid case d2target.DiamondArrowhead: widthMultiplier = 11 heightMultiplier = 9 + case d2target.FilledCircleArrowhead: + widthMultiplier = 14 + heightMultiplier = 15 + case d2target.CircleArrowhead: + widthMultiplier = 14 + heightMultiplier = 15 case d2target.CfOne, d2target.CfMany, d2target.CfOneRequired, d2target.CfManyRequired: widthMultiplier = 14 heightMultiplier = 15 @@ -224,6 +230,39 @@ func arrowheadMarker(isTarget bool, id string, connection d2target.Connection) s width*0.6, height*7/8, ) } + case d2target.FilledCircleArrowhead: + attrs := fmt.Sprintf(`class="connection" fill="%s" stroke-width="%d"`, connection.Stroke, connection.StrokeWidth) + offset := 4.0 + float64(connection.StrokeWidth*2) + if isTarget { + path = fmt.Sprintf(``, + attrs, + offset+9, height/2, + offset*1.2, + ) + } else { + path = fmt.Sprintf(``, + attrs, + offset+3, height/2, + offset*1.2, + ) + } + case d2target.CircleArrowhead: + attrs := fmt.Sprintf(`class="connection" fill="white" stroke="%s" stroke-width="%d"`, connection.Stroke, connection.StrokeWidth) + offset := 4.0 + float64(connection.StrokeWidth*2) + if isTarget { + path = fmt.Sprintf(``, + attrs, + offset+10, height/2, + offset*1.2, + ) + } else { + path = fmt.Sprintf(``, + attrs, + offset+6, height/2, + offset*1.2, + ) + } + case d2target.CfOne, d2target.CfMany, d2target.CfOneRequired, d2target.CfManyRequired: attrs := fmt.Sprintf(`class="connection" stroke="%s" stroke-width="%d" fill="white"`, connection.Stroke, connection.StrokeWidth) offset := 4.0 + float64(connection.StrokeWidth*2) @@ -277,6 +316,14 @@ func arrowheadMarker(isTarget bool, id string, connection d2target.Connection) s refX = width/8 + 0.6*strokeWidth } width *= 1.1 + + case d2target.CircleArrowhead: + if isTarget { + refX = width - 0.6*strokeWidth + } else { + refX = width/8 + 0.6*strokeWidth + } + width *= 1.1 default: if isTarget { refX = width - 1.5*strokeWidth diff --git a/d2target/d2target.go b/d2target/d2target.go index b426adfd9..b324e4ff6 100644 --- a/d2target/d2target.go +++ b/d2target/d2target.go @@ -277,6 +277,8 @@ const ( TriangleArrowhead Arrowhead = "triangle" DiamondArrowhead Arrowhead = "diamond" FilledDiamondArrowhead Arrowhead = "filled-diamond" + CircleArrowhead Arrowhead = "circle" + FilledCircleArrowhead Arrowhead = "circle-filled" // For fat arrows LineArrowhead Arrowhead = "line" @@ -294,6 +296,8 @@ var Arrowheads = map[string]struct{}{ string(TriangleArrowhead): {}, string(DiamondArrowhead): {}, string(FilledDiamondArrowhead): {}, + string(CircleArrowhead): {}, + string(FilledCircleArrowhead): {}, string(CfOne): {}, string(CfMany): {}, string(CfOneRequired): {}, @@ -307,6 +311,11 @@ func ToArrowhead(arrowheadType string, filled bool) Arrowhead { return FilledDiamondArrowhead } return DiamondArrowhead + case string(CircleArrowhead): + if filled { + return FilledCircleArrowhead + } + return CircleArrowhead case string(ArrowArrowhead): return ArrowArrowhead case string(CfOne): diff --git a/e2etests/stable_test.go b/e2etests/stable_test.go index a8acc138a..680a18045 100644 --- a/e2etests/stable_test.go +++ b/e2etests/stable_test.go @@ -1762,6 +1762,29 @@ e <--> f: { target-arrowhead: { shape: cf-one-required } +}`, + }, + { + name: "circle_arrowhead", + script: ` +a <-> b: circle { + source-arrowhead: { + shape: circle + } + target-arrowhead: { + shape: circle + } +} + +c <--> d: circle-filled { + source-arrowhead: { + shape: circle + style.filled: true + } + target-arrowhead: { + shape: circle + style.filled: true + } }`, }, } From acf04be5e548c653e1464271f8fca4bdf18a4e10 Mon Sep 17 00:00:00 2001 From: Paracelsus-Rose <103412754+Paracelsus-Rose@users.noreply.github.com> Date: Mon, 9 Jan 2023 22:53:19 -0500 Subject: [PATCH 02/19] Update next.md --- ci/release/changelogs/next.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/release/changelogs/next.md b/ci/release/changelogs/next.md index 955808118..fda4c774c 100644 --- a/ci/release/changelogs/next.md +++ b/ci/release/changelogs/next.md @@ -1,5 +1,5 @@ #### Features ๐Ÿš€ -- Circle notation is now supported. [] +- Circle notation is now supported. [#634](https://github.com/terrastruct/d2/pull/634) #### Improvements ๐Ÿงน #### Bugfixes โ›‘๏ธ From 2154c3b02ad689734d10e1ec255662f75cc535ef Mon Sep 17 00:00:00 2001 From: Paracelsus-Rose <103412754+Paracelsus-Rose@users.noreply.github.com> Date: Mon, 9 Jan 2023 23:04:41 -0500 Subject: [PATCH 03/19] Update stable_test.go --- e2etests/stable_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2etests/stable_test.go b/e2etests/stable_test.go index 680a18045..98e366c39 100644 --- a/e2etests/stable_test.go +++ b/e2etests/stable_test.go @@ -1776,7 +1776,7 @@ a <-> b: circle { } } -c <--> d: circle-filled { +c <-> d: circle-filled { source-arrowhead: { shape: circle style.filled: true From 649dbb13c281a4b4e968d19291894a59c34fb888 Mon Sep 17 00:00:00 2001 From: Paracelsus-Rose Date: Mon, 9 Jan 2023 23:40:03 -0500 Subject: [PATCH 04/19] Tests --- .../circle_arrowhead/dagre/board.exp.json | 264 ++++++++++++++++++ .../circle_arrowhead/dagre/sketch.exp.svg | 60 ++++ .../circle_arrowhead/elk/board.exp.json | 246 ++++++++++++++++ .../circle_arrowhead/elk/sketch.exp.svg | 60 ++++ 4 files changed, 630 insertions(+) create mode 100644 e2etests/testdata/stable/circle_arrowhead/dagre/board.exp.json create mode 100644 e2etests/testdata/stable/circle_arrowhead/dagre/sketch.exp.svg create mode 100644 e2etests/testdata/stable/circle_arrowhead/elk/board.exp.json create mode 100644 e2etests/testdata/stable/circle_arrowhead/elk/sketch.exp.svg diff --git a/e2etests/testdata/stable/circle_arrowhead/dagre/board.exp.json b/e2etests/testdata/stable/circle_arrowhead/dagre/board.exp.json new file mode 100644 index 000000000..acf9c5535 --- /dev/null +++ b/e2etests/testdata/stable/circle_arrowhead/dagre/board.exp.json @@ -0,0 +1,264 @@ +{ + "name": "", + "fontFamily": "SourceSansPro", + "shapes": [ + { + "id": "a", + "type": "", + "pos": { + "x": 0, + "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": "a", + "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": "b", + "type": "", + "pos": { + "x": 0, + "y": 247 + }, + "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": "b", + "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": "c", + "type": "", + "pos": { + "x": 174, + "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": "c", + "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": "d", + "type": "", + "pos": { + "x": 173, + "y": 247 + }, + "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": "d", + "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 + } + ], + "connections": [ + { + "id": "(a <-> b)[0]", + "src": "a", + "srcArrow": "circle", + "srcLabel": "", + "dst": "b", + "dstArrow": "circle", + "dstLabel": "", + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "stroke": "#0D32B2", + "label": "circle", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "#676C7E", + "italic": true, + "bold": false, + "underline": false, + "labelWidth": 36, + "labelHeight": 21, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "labelPercentage": 0, + "route": [ + { + "x": 56.5, + "y": 126 + }, + { + "x": 56.5, + "y": 174.4 + }, + { + "x": 56.5, + "y": 198.7 + }, + { + "x": 56.5, + "y": 247.5 + } + ], + "isCurve": true, + "animated": false, + "tooltip": "", + "icon": null, + "zIndex": 0 + }, + { + "id": "(c <-> d)[0]", + "src": "c", + "srcArrow": "circle-filled", + "srcLabel": "", + "dst": "d", + "dstArrow": "circle-filled", + "dstLabel": "", + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "stroke": "#0D32B2", + "label": "circle-filled", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "#676C7E", + "italic": true, + "bold": false, + "underline": false, + "labelWidth": 73, + "labelHeight": 21, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "labelPercentage": 0, + "route": [ + { + "x": 230, + "y": 126 + }, + { + "x": 230, + "y": 174.4 + }, + { + "x": 230, + "y": 198.7 + }, + { + "x": 230, + "y": 247.5 + } + ], + "isCurve": true, + "animated": false, + "tooltip": "", + "icon": null, + "zIndex": 0 + } + ] +} diff --git a/e2etests/testdata/stable/circle_arrowhead/dagre/sketch.exp.svg b/e2etests/testdata/stable/circle_arrowhead/dagre/sketch.exp.svg new file mode 100644 index 000000000..a5a5eefa6 --- /dev/null +++ b/e2etests/testdata/stable/circle_arrowhead/dagre/sketch.exp.svg @@ -0,0 +1,60 @@ + +abcd circle circle-filled + + + + \ No newline at end of file diff --git a/e2etests/testdata/stable/circle_arrowhead/elk/board.exp.json b/e2etests/testdata/stable/circle_arrowhead/elk/board.exp.json new file mode 100644 index 000000000..f75bfeb10 --- /dev/null +++ b/e2etests/testdata/stable/circle_arrowhead/elk/board.exp.json @@ -0,0 +1,246 @@ +{ + "name": "", + "fontFamily": "SourceSansPro", + "shapes": [ + { + "id": "a", + "type": "", + "pos": { + "x": 12, + "y": 12 + }, + "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": "a", + "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": "b", + "type": "", + "pos": { + "x": 12, + "y": 359 + }, + "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": "b", + "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": "c", + "type": "", + "pos": { + "x": 145, + "y": 12 + }, + "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": "c", + "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": "d", + "type": "", + "pos": { + "x": 145, + "y": 359 + }, + "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": "d", + "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 + } + ], + "connections": [ + { + "id": "(a <-> b)[0]", + "src": "a", + "srcArrow": "circle", + "srcLabel": "", + "dst": "b", + "dstArrow": "circle", + "dstLabel": "", + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "stroke": "#0D32B2", + "label": "circle", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "#676C7E", + "italic": true, + "bold": false, + "underline": false, + "labelWidth": 36, + "labelHeight": 21, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "labelPercentage": 0, + "route": [ + { + "x": 68.5, + "y": 138 + }, + { + "x": 68.5, + "y": 359 + } + ], + "animated": false, + "tooltip": "", + "icon": null, + "zIndex": 0 + }, + { + "id": "(c <-> d)[0]", + "src": "c", + "srcArrow": "circle-filled", + "srcLabel": "", + "dst": "d", + "dstArrow": "circle-filled", + "dstLabel": "", + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "stroke": "#0D32B2", + "label": "circle-filled", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "#676C7E", + "italic": true, + "bold": false, + "underline": false, + "labelWidth": 73, + "labelHeight": 21, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "labelPercentage": 0, + "route": [ + { + "x": 202, + "y": 138 + }, + { + "x": 202, + "y": 359 + } + ], + "animated": false, + "tooltip": "", + "icon": null, + "zIndex": 0 + } + ] +} diff --git a/e2etests/testdata/stable/circle_arrowhead/elk/sketch.exp.svg b/e2etests/testdata/stable/circle_arrowhead/elk/sketch.exp.svg new file mode 100644 index 000000000..7161bc2b1 --- /dev/null +++ b/e2etests/testdata/stable/circle_arrowhead/elk/sketch.exp.svg @@ -0,0 +1,60 @@ + +abcd circle circle-filled + + + + \ No newline at end of file From 2c59b1c16352c5fb976d704a924faa0afa69bd22 Mon Sep 17 00:00:00 2001 From: Paracelsus-Rose Date: Mon, 9 Jan 2023 23:48:26 -0500 Subject: [PATCH 05/19] Formatting --- d2renderers/d2svg/d2svg.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/d2renderers/d2svg/d2svg.go b/d2renderers/d2svg/d2svg.go index 91b18c54a..fa2ffafa9 100644 --- a/d2renderers/d2svg/d2svg.go +++ b/d2renderers/d2svg/d2svg.go @@ -114,10 +114,7 @@ func arrowheadDimensions(arrowhead d2target.Arrowhead, strokeWidth float64) (wid case d2target.DiamondArrowhead: widthMultiplier = 11 heightMultiplier = 9 - case d2target.FilledCircleArrowhead: - widthMultiplier = 14 - heightMultiplier = 15 - case d2target.CircleArrowhead: + case d2target.FilledCircleArrowhead, d2target.CircleArrowhead: widthMultiplier = 14 heightMultiplier = 15 case d2target.CfOne, d2target.CfMany, d2target.CfOneRequired, d2target.CfManyRequired: From d46ce55c2f7d1dd63b1d47dc7911db234577bd51 Mon Sep 17 00:00:00 2001 From: Paracelsus-Rose <103412754+Paracelsus-Rose@users.noreply.github.com> Date: Tue, 10 Jan 2023 12:08:26 -0500 Subject: [PATCH 06/19] Update d2svg.go --- d2renderers/d2svg/d2svg.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/d2renderers/d2svg/d2svg.go b/d2renderers/d2svg/d2svg.go index fa2ffafa9..37dedce2b 100644 --- a/d2renderers/d2svg/d2svg.go +++ b/d2renderers/d2svg/d2svg.go @@ -114,10 +114,7 @@ func arrowheadDimensions(arrowhead d2target.Arrowhead, strokeWidth float64) (wid case d2target.DiamondArrowhead: widthMultiplier = 11 heightMultiplier = 9 - case d2target.FilledCircleArrowhead, d2target.CircleArrowhead: - widthMultiplier = 14 - heightMultiplier = 15 - case d2target.CfOne, d2target.CfMany, d2target.CfOneRequired, d2target.CfManyRequired: + case d2target.CfOne, d2target.CfMany, d2target.CfOneRequired, d2target.CfManyRequired, d2target.FilledCircleArrowhead, d2target.CircleArrowhead: widthMultiplier = 14 heightMultiplier = 15 } From 73aeae484503dfea3d3b430b6c5509feac180cc1 Mon Sep 17 00:00:00 2001 From: Paracelsus-Rose <103412754+Paracelsus-Rose@users.noreply.github.com> Date: Tue, 10 Jan 2023 12:09:20 -0500 Subject: [PATCH 07/19] Update next.md --- ci/release/changelogs/next.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/release/changelogs/next.md b/ci/release/changelogs/next.md index fda4c774c..cfdebd299 100644 --- a/ci/release/changelogs/next.md +++ b/ci/release/changelogs/next.md @@ -1,5 +1,5 @@ #### Features ๐Ÿš€ -- Circle notation is now supported. [#634](https://github.com/terrastruct/d2/pull/634) +- Circle arrowheads are now supported. [#634](https://github.com/terrastruct/d2/pull/634) #### Improvements ๐Ÿงน #### Bugfixes โ›‘๏ธ From 7cdec21ec8d28dd82947b8a276ea2686f21b52bb Mon Sep 17 00:00:00 2001 From: Paracelsus-Rose <103412754+Paracelsus-Rose@users.noreply.github.com> Date: Tue, 10 Jan 2023 12:11:06 -0500 Subject: [PATCH 08/19] Update d2target.go --- d2target/d2target.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/d2target/d2target.go b/d2target/d2target.go index b324e4ff6..8a2ae89fb 100644 --- a/d2target/d2target.go +++ b/d2target/d2target.go @@ -278,7 +278,7 @@ const ( DiamondArrowhead Arrowhead = "diamond" FilledDiamondArrowhead Arrowhead = "filled-diamond" CircleArrowhead Arrowhead = "circle" - FilledCircleArrowhead Arrowhead = "circle-filled" + FilledCircleArrowhead Arrowhead = "filled-circle" // For fat arrows LineArrowhead Arrowhead = "line" From bc1b7b8ef9d9f6356abc881080bad05950c1b52f Mon Sep 17 00:00:00 2001 From: Paracelsus-Rose <103412754+Paracelsus-Rose@users.noreply.github.com> Date: Tue, 10 Jan 2023 12:12:24 -0500 Subject: [PATCH 09/19] Update stable_test.go --- e2etests/stable_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2etests/stable_test.go b/e2etests/stable_test.go index 98e366c39..4257c4d1a 100644 --- a/e2etests/stable_test.go +++ b/e2etests/stable_test.go @@ -1776,7 +1776,7 @@ a <-> b: circle { } } -c <-> d: circle-filled { +c <-> d: filled-circle { source-arrowhead: { shape: circle style.filled: true From fc15982b93036f3a8706a42ef37231617347020b Mon Sep 17 00:00:00 2001 From: Paracelsus-Rose Date: Tue, 10 Jan 2023 12:48:54 -0500 Subject: [PATCH 10/19] Requested Changes --- d2renderers/d2svg/d2svg.go | 8 ++++---- .../testdata/stable/circle_arrowhead/dagre/board.exp.json | 6 +++--- .../testdata/stable/circle_arrowhead/dagre/sketch.exp.svg | 2 +- .../testdata/stable/circle_arrowhead/elk/board.exp.json | 6 +++--- .../testdata/stable/circle_arrowhead/elk/sketch.exp.svg | 2 +- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/d2renderers/d2svg/d2svg.go b/d2renderers/d2svg/d2svg.go index 37dedce2b..22f984345 100644 --- a/d2renderers/d2svg/d2svg.go +++ b/d2renderers/d2svg/d2svg.go @@ -230,13 +230,13 @@ func arrowheadMarker(isTarget bool, id string, connection d2target.Connection) s if isTarget { path = fmt.Sprintf(``, attrs, - offset+9, height/2, + offset+11, height/2, offset*1.2, ) } else { path = fmt.Sprintf(``, attrs, - offset+3, height/2, + offset+1, height/2, offset*1.2, ) } @@ -246,13 +246,13 @@ func arrowheadMarker(isTarget bool, id string, connection d2target.Connection) s if isTarget { path = fmt.Sprintf(``, attrs, - offset+10, height/2, + offset+12, height/2, offset*1.2, ) } else { path = fmt.Sprintf(``, attrs, - offset+6, height/2, + offset+4, height/2, offset*1.2, ) } diff --git a/e2etests/testdata/stable/circle_arrowhead/dagre/board.exp.json b/e2etests/testdata/stable/circle_arrowhead/dagre/board.exp.json index acf9c5535..82f04068a 100644 --- a/e2etests/testdata/stable/circle_arrowhead/dagre/board.exp.json +++ b/e2etests/testdata/stable/circle_arrowhead/dagre/board.exp.json @@ -215,16 +215,16 @@ { "id": "(c <-> d)[0]", "src": "c", - "srcArrow": "circle-filled", + "srcArrow": "filled-circle", "srcLabel": "", "dst": "d", - "dstArrow": "circle-filled", + "dstArrow": "filled-circle", "dstLabel": "", "opacity": 1, "strokeDash": 0, "strokeWidth": 2, "stroke": "#0D32B2", - "label": "circle-filled", + "label": "filled-circle", "fontSize": 16, "fontFamily": "DEFAULT", "language": "", diff --git a/e2etests/testdata/stable/circle_arrowhead/dagre/sketch.exp.svg b/e2etests/testdata/stable/circle_arrowhead/dagre/sketch.exp.svg index a5a5eefa6..8ca984fdc 100644 --- a/e2etests/testdata/stable/circle_arrowhead/dagre/sketch.exp.svg +++ b/e2etests/testdata/stable/circle_arrowhead/dagre/sketch.exp.svg @@ -39,7 +39,7 @@ width="491" height="577" viewBox="-102 -102 491 577">abcd circle filled-circle + + + + \ No newline at end of file diff --git a/e2etests/testdata/stable/circle_arrowhead#01/elk/board.exp.json b/e2etests/testdata/stable/circle_arrowhead#01/elk/board.exp.json new file mode 100644 index 000000000..bb09866a6 --- /dev/null +++ b/e2etests/testdata/stable/circle_arrowhead#01/elk/board.exp.json @@ -0,0 +1,246 @@ +{ + "name": "", + "fontFamily": "SourceSansPro", + "shapes": [ + { + "id": "a", + "type": "", + "pos": { + "x": 12, + "y": 12 + }, + "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": "a", + "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": "b", + "type": "", + "pos": { + "x": 12, + "y": 359 + }, + "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": "b", + "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": "c", + "type": "", + "pos": { + "x": 145, + "y": 12 + }, + "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": "c", + "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": "d", + "type": "", + "pos": { + "x": 145, + "y": 359 + }, + "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": "d", + "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 + } + ], + "connections": [ + { + "id": "(a <-> b)[0]", + "src": "a", + "srcArrow": "circle", + "srcLabel": "", + "dst": "b", + "dstArrow": "circle", + "dstLabel": "", + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "stroke": "#0D32B2", + "label": "circle", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "#676C7E", + "italic": true, + "bold": false, + "underline": false, + "labelWidth": 36, + "labelHeight": 21, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "labelPercentage": 0, + "route": [ + { + "x": 68.5, + "y": 138 + }, + { + "x": 68.5, + "y": 359 + } + ], + "animated": false, + "tooltip": "", + "icon": null, + "zIndex": 0 + }, + { + "id": "(c <-> d)[0]", + "src": "c", + "srcArrow": "filled-circle", + "srcLabel": "", + "dst": "d", + "dstArrow": "filled-circle", + "dstLabel": "", + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "stroke": "#0D32B2", + "label": "filled-circle", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "#676C7E", + "italic": true, + "bold": false, + "underline": false, + "labelWidth": 73, + "labelHeight": 21, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "labelPercentage": 0, + "route": [ + { + "x": 202, + "y": 138 + }, + { + "x": 202, + "y": 359 + } + ], + "animated": false, + "tooltip": "", + "icon": null, + "zIndex": 0 + } + ] +} diff --git a/e2etests/testdata/stable/circle_arrowhead#01/elk/sketch.exp.svg b/e2etests/testdata/stable/circle_arrowhead#01/elk/sketch.exp.svg new file mode 100644 index 000000000..0d9c1f70f --- /dev/null +++ b/e2etests/testdata/stable/circle_arrowhead#01/elk/sketch.exp.svg @@ -0,0 +1,60 @@ + +abcd circle filled-circle + + + + \ No newline at end of file diff --git a/e2etests/testdata/stable/circle_arrowhead/dagre/sketch.exp.svg b/e2etests/testdata/stable/circle_arrowhead/dagre/sketch.exp.svg index 60d459d6a..e8e6605e7 100644 --- a/e2etests/testdata/stable/circle_arrowhead/dagre/sketch.exp.svg +++ b/e2etests/testdata/stable/circle_arrowhead/dagre/sketch.exp.svg @@ -39,7 +39,7 @@ width="491" height="577" viewBox="-102 -102 491 577">abcd circle filled-circle - - - - \ No newline at end of file diff --git a/e2etests/testdata/stable/circle_arrowhead#01/elk/board.exp.json b/e2etests/testdata/stable/circle_arrowhead#01/elk/board.exp.json deleted file mode 100644 index bb09866a6..000000000 --- a/e2etests/testdata/stable/circle_arrowhead#01/elk/board.exp.json +++ /dev/null @@ -1,246 +0,0 @@ -{ - "name": "", - "fontFamily": "SourceSansPro", - "shapes": [ - { - "id": "a", - "type": "", - "pos": { - "x": 12, - "y": 12 - }, - "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": "a", - "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": "b", - "type": "", - "pos": { - "x": 12, - "y": 359 - }, - "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": "b", - "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": "c", - "type": "", - "pos": { - "x": 145, - "y": 12 - }, - "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": "c", - "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": "d", - "type": "", - "pos": { - "x": 145, - "y": 359 - }, - "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": "d", - "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 - } - ], - "connections": [ - { - "id": "(a <-> b)[0]", - "src": "a", - "srcArrow": "circle", - "srcLabel": "", - "dst": "b", - "dstArrow": "circle", - "dstLabel": "", - "opacity": 1, - "strokeDash": 0, - "strokeWidth": 2, - "stroke": "#0D32B2", - "label": "circle", - "fontSize": 16, - "fontFamily": "DEFAULT", - "language": "", - "color": "#676C7E", - "italic": true, - "bold": false, - "underline": false, - "labelWidth": 36, - "labelHeight": 21, - "labelPosition": "INSIDE_MIDDLE_CENTER", - "labelPercentage": 0, - "route": [ - { - "x": 68.5, - "y": 138 - }, - { - "x": 68.5, - "y": 359 - } - ], - "animated": false, - "tooltip": "", - "icon": null, - "zIndex": 0 - }, - { - "id": "(c <-> d)[0]", - "src": "c", - "srcArrow": "filled-circle", - "srcLabel": "", - "dst": "d", - "dstArrow": "filled-circle", - "dstLabel": "", - "opacity": 1, - "strokeDash": 0, - "strokeWidth": 2, - "stroke": "#0D32B2", - "label": "filled-circle", - "fontSize": 16, - "fontFamily": "DEFAULT", - "language": "", - "color": "#676C7E", - "italic": true, - "bold": false, - "underline": false, - "labelWidth": 73, - "labelHeight": 21, - "labelPosition": "INSIDE_MIDDLE_CENTER", - "labelPercentage": 0, - "route": [ - { - "x": 202, - "y": 138 - }, - { - "x": 202, - "y": 359 - } - ], - "animated": false, - "tooltip": "", - "icon": null, - "zIndex": 0 - } - ] -} diff --git a/e2etests/testdata/stable/circle_arrowhead#01/elk/sketch.exp.svg b/e2etests/testdata/stable/circle_arrowhead#01/elk/sketch.exp.svg deleted file mode 100644 index 0d9c1f70f..000000000 --- a/e2etests/testdata/stable/circle_arrowhead#01/elk/sketch.exp.svg +++ /dev/null @@ -1,60 +0,0 @@ - -abcd circle filled-circle - - - - \ No newline at end of file From 182e3b0254442d788d27d36110446d5923221110 Mon Sep 17 00:00:00 2001 From: Paracelsus-Rose Date: Thu, 19 Jan 2023 20:50:27 -0500 Subject: [PATCH 19/19] submodule --- ci/sub | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/sub b/ci/sub index 9a29d9ea6..23984e4d7 160000 --- a/ci/sub +++ b/ci/sub @@ -1 +1 @@ -Subproject commit 9a29d9ea640834905c4010c0b3d14b7301ebb6d8 +Subproject commit 23984e4d743dd9977b513c0fd850a4996c9198a5