From 368fc938d15abb88cd52add9544b40de0ce90da4 Mon Sep 17 00:00:00 2001 From: Daniel Suh <23denial@gmail.com> Date: Mon, 20 May 2024 07:39:06 -0400 Subject: [PATCH 1/8] make paths normal --- d2renderers/d2sketch/sketch.go | 71 +++++-- d2renderers/d2svg/d2svg.go | 175 +---------------- e2etests/testdata/txtar.txt | 6 + .../dagre/board.exp.json | 122 ++++++------ .../dagre/sketch.exp.svg | 180 +++++++++--------- .../elk/board.exp.json | 90 +++++---- .../elk/sketch.exp.svg | 180 +++++++++--------- lib/svg/path.go | 179 +++++++++++++++++ 8 files changed, 548 insertions(+), 455 deletions(-) diff --git a/d2renderers/d2sketch/sketch.go b/d2renderers/d2sketch/sketch.go index 3ab9e8c27..8c2ec056e 100644 --- a/d2renderers/d2sketch/sketch.go +++ b/d2renderers/d2sketch/sketch.go @@ -6,6 +6,7 @@ import ( "fmt" "regexp" "strings" + "unicode" _ "embed" @@ -327,23 +328,71 @@ func Connection(r *Runner, connection d2target.Connection, path, attrs string) ( if err != nil { return "", err } - output := "" + + finalPath := "" + + insertSpacesAfterLetters := func(s string) { + output := "" + for i := 0; i < len(s); i++ { + if s[i] != ',' { + output += string(s[i]) + } + if unicode.IsLetter(rune(s[i])) { + output += " " + } + } + fmt.Println("PATH", output) + finalPath += output + } + fmt.Println() + + for i := 0; i < len(paths); i++ { + insertSpacesAfterLetters(paths[i]) + } + animatedClass := "" if connection.Animated { animatedClass = " animated-connection" } - pathEl := d2themes.NewThemableElement("path") - pathEl.Fill = color.None - pathEl.Stroke = connection.Stroke - pathEl.ClassName = fmt.Sprintf("connection%s", animatedClass) - pathEl.Style = connection.CSSStyle() - pathEl.Attributes = attrs - for _, p := range paths { - pathEl.D = p - output += pathEl.Render() + // If connection is animated and bidirectional + if connection.Animated && ((connection.DstArrow == d2target.NoArrowhead && connection.SrcArrow == d2target.NoArrowhead) || (connection.DstArrow != d2target.NoArrowhead && connection.SrcArrow != d2target.NoArrowhead)) { + // There is no pure CSS way to animate bidirectional connections in two directions, so we split it up + path1, path2, err := svg.SplitPath(path, 0.5) + + if err != nil { + return "", err + } + + pathEl1 := d2themes.NewThemableElement("path") + pathEl1.D = path1 + pathEl1.Fill = color.None + pathEl1.Stroke = connection.Stroke + pathEl1.ClassName = fmt.Sprintf("connection%s", animatedClass) + pathEl1.Style = connection.CSSStyle() + pathEl1.Style += "animation-direction: reverse;" + pathEl1.Attributes = attrs + + pathEl2 := d2themes.NewThemableElement("path") + pathEl2.D = path2 + pathEl2.Fill = color.None + pathEl2.Stroke = connection.Stroke + pathEl2.ClassName = fmt.Sprintf("connection%s", animatedClass) + pathEl2.Style = connection.CSSStyle() + pathEl2.Attributes = attrs + // return pathEl1.Render(), nil + return pathEl2.Render(), nil + // return pathEl1.Render() + " " + pathEl2.Render(), nil + } else { + pathEl := d2themes.NewThemableElement("path") + pathEl.D = finalPath + pathEl.Fill = color.None + pathEl.Stroke = connection.Stroke + pathEl.ClassName = fmt.Sprintf("connection%s", animatedClass) + pathEl.Style = connection.CSSStyle() + pathEl.Attributes = attrs + return pathEl.Render(), nil } - return output, nil } // TODO cleanup diff --git a/d2renderers/d2svg/d2svg.go b/d2renderers/d2svg/d2svg.go index 9faf2a361..9360c3eed 100644 --- a/d2renderers/d2svg/d2svg.go +++ b/d2renderers/d2svg/d2svg.go @@ -11,7 +11,6 @@ import ( "html" "io" "sort" - "strconv" "strings" "math" @@ -495,178 +494,6 @@ func makeLabelMask(labelTL *geo.Point, width, height int, opacity float64) strin ) } -// Gets a certain line/curve's SVG path string. offsetIdx and pathData provides the points needed -func getSVGPathString(pathType string, offsetIdx int, pathData []string) (string, error) { - switch pathType { - case "M": - return fmt.Sprintf("M %s %s ", pathData[offsetIdx+1], pathData[offsetIdx+2]), nil - case "L": - return fmt.Sprintf("L %s %s ", pathData[offsetIdx+1], pathData[offsetIdx+2]), nil - case "C": - return fmt.Sprintf("C %s %s %s %s %s %s ", pathData[offsetIdx+1], pathData[offsetIdx+2], pathData[offsetIdx+3], pathData[offsetIdx+4], pathData[offsetIdx+5], pathData[offsetIdx+6]), nil - case "S": - return fmt.Sprintf("S %s %s %s %s ", pathData[offsetIdx+1], pathData[offsetIdx+2], pathData[offsetIdx+3], pathData[offsetIdx+4]), nil - default: - return "", fmt.Errorf("unknown svg path command \"%s\"", pathData[offsetIdx]) - } -} - -// Gets how much to increment by on an SVG string to get to the next path command -func getPathStringIncrement(pathType string) (int, error) { - switch pathType { - case "M": - return 3, nil - case "L": - return 3, nil - case "C": - return 7, nil - case "S": - return 5, nil - default: - return 0, fmt.Errorf("unknown svg path command \"%s\"", pathType) - } -} - -// This function finds the length of a path in SVG notation -func pathLength(pathData []string) (float64, error) { - var x, y, pathLength float64 - var prevPosition geo.Point - var increment int - - for i := 0; i < len(pathData); i += increment { - switch pathData[i] { - case "M": - x, _ = strconv.ParseFloat(pathData[i+1], 64) - y, _ = strconv.ParseFloat(pathData[i+2], 64) - case "L": - x, _ = strconv.ParseFloat(pathData[i+1], 64) - y, _ = strconv.ParseFloat(pathData[i+2], 64) - - pathLength += geo.EuclideanDistance(prevPosition.X, prevPosition.Y, x, y) - case "C": - x, _ = strconv.ParseFloat(pathData[i+5], 64) - y, _ = strconv.ParseFloat(pathData[i+6], 64) - - pathLength += geo.EuclideanDistance(prevPosition.X, prevPosition.Y, x, y) - case "S": - x, _ = strconv.ParseFloat(pathData[i+3], 64) - y, _ = strconv.ParseFloat(pathData[i+4], 64) - - pathLength += geo.EuclideanDistance(prevPosition.X, prevPosition.Y, x, y) - default: - return 0, fmt.Errorf("unknown svg path command \"%s\"", pathData[i]) - } - - prevPosition = geo.Point{X: x, Y: y} - - incr, err := getPathStringIncrement(pathData[i]) - - if err != nil { - return 0, err - } - - increment = incr - } - - return pathLength, nil -} - -// Splits an SVG path into two SVG paths, with the first path being ~{percentage}% of the path -func splitPath(path string, percentage float64) (string, string, error) { - var sumPathLens, curPathLen, x, y float64 - var prevPosition geo.Point - var path1, path2 string - var increment int - - pastHalf := false - pathData := strings.Split(path, " ") - pathLen, err := pathLength(pathData) - - if err != nil { - return "", "", err - } - - for i := 0; i < len(pathData); i += increment { - switch pathData[i] { - case "M": - x, _ = strconv.ParseFloat(pathData[i+1], 64) - y, _ = strconv.ParseFloat(pathData[i+2], 64) - case "L": - x, _ = strconv.ParseFloat(pathData[i+1], 64) - y, _ = strconv.ParseFloat(pathData[i+2], 64) - - curPathLen = geo.EuclideanDistance(prevPosition.X, prevPosition.Y, x, y) - case "C": - x, _ = strconv.ParseFloat(pathData[i+5], 64) - y, _ = strconv.ParseFloat(pathData[i+6], 64) - - curPathLen = geo.EuclideanDistance(prevPosition.X, prevPosition.Y, x, y) - case "S": - x, _ = strconv.ParseFloat(pathData[i+3], 64) - y, _ = strconv.ParseFloat(pathData[i+4], 64) - - curPathLen = geo.EuclideanDistance(prevPosition.X, prevPosition.Y, x, y) - default: - return "", "", fmt.Errorf("unknown svg path command \"%s\"", pathData[i]) - } - - curPath, err := getSVGPathString(pathData[i], i, pathData) - if err != nil { - return "", "", err - } - - sumPathLens += curPathLen - - if pastHalf { // add to path2 - path2 += curPath - } else if sumPathLens < pathLen*percentage { // add to path1 - path1 += curPath - } else { // transition from path1 -> path2 - t := (pathLen*percentage - sumPathLens + curPathLen) / curPathLen - - switch pathData[i] { - case "L": - path1 += fmt.Sprintf("L %f %f ", (x-prevPosition.X)*t+prevPosition.X, (y-prevPosition.Y)*t+prevPosition.Y) - path2 += fmt.Sprintf("M %f %f L %f %f ", (x-prevPosition.X)*t+prevPosition.X, (y-prevPosition.Y)*t+prevPosition.Y, x, y) - case "C": - h1x, _ := strconv.ParseFloat(pathData[i+1], 64) - h1y, _ := strconv.ParseFloat(pathData[i+2], 64) - h2x, _ := strconv.ParseFloat(pathData[i+3], 64) - h2y, _ := strconv.ParseFloat(pathData[i+4], 64) - - heading1 := geo.Point{X: h1x, Y: h1y} - heading2 := geo.Point{X: h2x, Y: h2y} - nextPoint := geo.Point{X: x, Y: y} - - q1, q2, q3, q4 := svg.BezierCurveSegment(&prevPosition, &heading1, &heading2, &nextPoint, 0, 0.5) - path1 += fmt.Sprintf("C %f %f %f %f %f %f ", q2.X, q2.Y, q3.X, q3.Y, q4.X, q4.Y) - - q1, q2, q3, q4 = svg.BezierCurveSegment(&prevPosition, &heading1, &heading2, &nextPoint, 0.5, 1) - path2 += fmt.Sprintf("M %f %f C %f %f %f %f %f %f ", q1.X, q1.Y, q2.X, q2.Y, q3.X, q3.Y, q4.X, q4.Y) - case "S": - // Skip S curves because they are shorter and we can split along the connection to the next path instead - path1 += fmt.Sprintf("S %s %s %s %s ", pathData[i+1], pathData[i+2], pathData[i+3], pathData[i+4]) - path2 += fmt.Sprintf("M %s %s ", pathData[i+3], pathData[i+4]) - default: - return "", "", fmt.Errorf("unknown svg path command \"%s\"", pathData[i]) - } - - pastHalf = true - } - - incr, err := getPathStringIncrement(pathData[i]) - - if err != nil { - return "", "", err - } - - increment = incr - prevPosition = geo.Point{X: x, Y: y} - } - - return path1, path2, nil -} - func drawConnection(writer io.Writer, labelMaskID string, connection d2target.Connection, markers map[string]struct{}, idToShape map[string]d2target.Shape, sketchRunner *d2sketch.Runner) (labelMask string, _ error) { opacityStyle := "" if connection.Opacity != 1.0 { @@ -745,7 +572,7 @@ func drawConnection(writer io.Writer, labelMaskID string, connection d2target.Co // If connection is animated and bidirectional if connection.Animated && ((connection.DstArrow == d2target.NoArrowhead && connection.SrcArrow == d2target.NoArrowhead) || (connection.DstArrow != d2target.NoArrowhead && connection.SrcArrow != d2target.NoArrowhead)) { // There is no pure CSS way to animate bidirectional connections in two directions, so we split it up - path1, path2, err := splitPath(path, 0.5) + path1, path2, err := svg.SplitPath(path, 0.5) if err != nil { return "", err diff --git a/e2etests/testdata/txtar.txt b/e2etests/testdata/txtar.txt index 19692fcd8..351eea8a1 100644 --- a/e2etests/testdata/txtar.txt +++ b/e2etests/testdata/txtar.txt @@ -215,6 +215,12 @@ ok: { } -- bidirectional_connection_animation -- +vars: { + d2-config: { + sketch: true + } +} + a <-> b: {style.animated: true} a <-> c: {style.animated: true} a <-> d: {style.animated: true} diff --git a/e2etests/testdata/txtar/bidirectional_connection_animation/dagre/board.exp.json b/e2etests/testdata/txtar/bidirectional_connection_animation/dagre/board.exp.json index 16c3d88b9..09c09cfbe 100644 --- a/e2etests/testdata/txtar/bidirectional_connection_animation/dagre/board.exp.json +++ b/e2etests/testdata/txtar/bidirectional_connection_animation/dagre/board.exp.json @@ -1,16 +1,24 @@ { "name": "", + "config": { + "sketch": true, + "themeID": null, + "darkThemeID": null, + "pad": null, + "center": null, + "layoutEngine": null + }, "isFolderOnly": false, - "fontFamily": "SourceSansPro", + "fontFamily": "HandDrawn", "shapes": [ { "id": "a", "type": "rectangle", "pos": { - "x": 170, + "x": 172, "y": 0 }, - "width": 53, + "width": 54, "height": 66, "opacity": 1, "strokeDash": 0, @@ -38,7 +46,7 @@ "italic": false, "bold": true, "underline": false, - "labelWidth": 8, + "labelWidth": 9, "labelHeight": 21, "labelPosition": "INSIDE_MIDDLE_CENTER", "zIndex": 0, @@ -51,7 +59,7 @@ "x": 0, "y": 166 }, - "width": 53, + "width": 55, "height": 66, "opacity": 1, "strokeDash": 0, @@ -79,7 +87,7 @@ "italic": false, "bold": true, "underline": false, - "labelWidth": 8, + "labelWidth": 10, "labelHeight": 21, "labelPosition": "INSIDE_MIDDLE_CENTER", "zIndex": 0, @@ -89,10 +97,10 @@ "id": "c", "type": "rectangle", "pos": { - "x": 113, + "x": 115, "y": 166 }, - "width": 53, + "width": 54, "height": 66, "opacity": 1, "strokeDash": 0, @@ -120,7 +128,7 @@ "italic": false, "bold": true, "underline": false, - "labelWidth": 8, + "labelWidth": 9, "labelHeight": 21, "labelPosition": "INSIDE_MIDDLE_CENTER", "zIndex": 0, @@ -130,10 +138,10 @@ "id": "d", "type": "rectangle", "pos": { - "x": 226, + "x": 229, "y": 166 }, - "width": 54, + "width": 55, "height": 66, "opacity": 1, "strokeDash": 0, @@ -161,7 +169,7 @@ "italic": false, "bold": true, "underline": false, - "labelWidth": 9, + "labelWidth": 10, "labelHeight": 21, "labelPosition": "INSIDE_MIDDLE_CENTER", "zIndex": 0, @@ -171,7 +179,7 @@ "id": "e", "type": "rectangle", "pos": { - "x": 340, + "x": 344, "y": 166 }, "width": 53, @@ -212,10 +220,10 @@ "id": "f", "type": "rectangle", "pos": { - "x": 455, + "x": 457, "y": 0 }, - "width": 51, + "width": 54, "height": 66, "opacity": 1, "strokeDash": 0, @@ -243,7 +251,7 @@ "italic": false, "bold": true, "underline": false, - "labelWidth": 6, + "labelWidth": 9, "labelHeight": 21, "labelPosition": "INSIDE_MIDDLE_CENTER", "zIndex": 0, @@ -253,7 +261,7 @@ "id": "g", "type": "rectangle", "pos": { - "x": 453, + "x": 457, "y": 166 }, "width": 54, @@ -294,10 +302,10 @@ "id": "x", "type": "rectangle", "pos": { - "x": 566, + "x": 571, "y": 0 }, - "width": 53, + "width": 54, "height": 66, "opacity": 1, "strokeDash": 0, @@ -325,7 +333,7 @@ "italic": false, "bold": true, "underline": false, - "labelWidth": 8, + "labelWidth": 9, "labelHeight": 21, "labelPosition": "INSIDE_MIDDLE_CENTER", "zIndex": 0, @@ -358,19 +366,19 @@ "labelPercentage": 0, "route": [ { - "x": 169.75, - "y": 45.957000732421875 + "x": 172.5, + "y": 46 }, { - "x": 55.14899826049805, - "y": 101.99099731445312 + "x": 56.5, + "y": 102 }, { - "x": 26.5, + "x": 27.5, "y": 126 }, { - "x": 26.5, + "x": 27.5, "y": 166 } ], @@ -405,19 +413,19 @@ "labelPercentage": 0, "route": [ { - "x": 173.5, + "x": 176, "y": 66 }, { - "x": 146.3000030517578, + "x": 148.8000030517578, "y": 106 }, { - "x": 139.5, + "x": 142, "y": 126 }, { - "x": 139.5, + "x": 142, "y": 166 } ], @@ -452,19 +460,19 @@ "labelPercentage": 0, "route": [ { - "x": 219, + "x": 222.5, "y": 66 }, { - "x": 246.1999969482422, + "x": 249.6999969482422, "y": 106 }, { - "x": 253, + "x": 256.5, "y": 126 }, { - "x": 253, + "x": 256.5, "y": 166 } ], @@ -499,19 +507,19 @@ "labelPercentage": 0, "route": [ { - "x": 222.5, - "y": 46 + "x": 226.25, + "y": 46.08599853515625 }, { - "x": 337.70001220703125, - "y": 102 + "x": 341.6499938964844, + "y": 102.01699829101562 }, { - "x": 366.5, + "x": 370.5, "y": 126 }, { - "x": 366.5, + "x": 370.5, "y": 166 } ], @@ -546,19 +554,19 @@ "labelPercentage": 0, "route": [ { - "x": 480, + "x": 484, "y": 66 }, { - "x": 480, + "x": 484, "y": 106 }, { - "x": 480, + "x": 484, "y": 126 }, { - "x": 480, + "x": 484, "y": 166 } ], @@ -593,55 +601,55 @@ "labelPercentage": 0, "route": [ { - "x": 619.166015625, + "x": 624.666015625, "y": 16 }, { - "x": 639.9660034179688, + "x": 646.2659912109375, "y": 3.1989998817443848 }, { - "x": 646.5, + "x": 653, "y": 0 }, { - "x": 648.5, + "x": 655, "y": 0 }, { - "x": 650.5, + "x": 657, "y": 0 }, { - "x": 653.166015625, + "x": 659.666015625, "y": 6.599999904632568 }, { - "x": 655.166015625, + "x": 661.666015625, "y": 16.5 }, { - "x": 657.166015625, + "x": 663.666015625, "y": 26.399999618530273 }, { - "x": 657.166015625, + "x": 663.666015625, "y": 39.599998474121094 }, { - "x": 655.166015625, + "x": 661.666015625, "y": 49.5 }, { - "x": 653.166015625, + "x": 659.666015625, "y": 59.400001525878906 }, { - "x": 639.9660034179688, + "x": 646.2659912109375, "y": 62.79999923706055 }, { - "x": 619.166015625, + "x": 624.666015625, "y": 50 } ], diff --git a/e2etests/testdata/txtar/bidirectional_connection_animation/dagre/sketch.exp.svg b/e2etests/testdata/txtar/bidirectional_connection_animation/dagre/sketch.exp.svg index 030120280..02f9b9fa1 100644 --- a/e2etests/testdata/txtar/bidirectional_connection_animation/dagre/sketch.exp.svg +++ b/e2etests/testdata/txtar/bidirectional_connection_animation/dagre/sketch.exp.svg @@ -1,16 +1,16 @@ -abcdefgx - - - - - - - - - + .d2-3469083568 .fill-N1{fill:#0A0F25;} + .d2-3469083568 .fill-N2{fill:#676C7E;} + .d2-3469083568 .fill-N3{fill:#9499AB;} + .d2-3469083568 .fill-N4{fill:#CFD2DD;} + .d2-3469083568 .fill-N5{fill:#DEE1EB;} + .d2-3469083568 .fill-N6{fill:#EEF1F8;} + .d2-3469083568 .fill-N7{fill:#FFFFFF;} + .d2-3469083568 .fill-B1{fill:#0D32B2;} + .d2-3469083568 .fill-B2{fill:#0D32B2;} + .d2-3469083568 .fill-B3{fill:#E3E9FD;} + .d2-3469083568 .fill-B4{fill:#E3E9FD;} + .d2-3469083568 .fill-B5{fill:#EDF0FD;} + .d2-3469083568 .fill-B6{fill:#F7F8FE;} + .d2-3469083568 .fill-AA2{fill:#4A6FF3;} + .d2-3469083568 .fill-AA4{fill:#EDF0FD;} + .d2-3469083568 .fill-AA5{fill:#F7F8FE;} + .d2-3469083568 .fill-AB4{fill:#EDF0FD;} + .d2-3469083568 .fill-AB5{fill:#F7F8FE;} + .d2-3469083568 .stroke-N1{stroke:#0A0F25;} + .d2-3469083568 .stroke-N2{stroke:#676C7E;} + .d2-3469083568 .stroke-N3{stroke:#9499AB;} + .d2-3469083568 .stroke-N4{stroke:#CFD2DD;} + .d2-3469083568 .stroke-N5{stroke:#DEE1EB;} + .d2-3469083568 .stroke-N6{stroke:#EEF1F8;} + .d2-3469083568 .stroke-N7{stroke:#FFFFFF;} + .d2-3469083568 .stroke-B1{stroke:#0D32B2;} + .d2-3469083568 .stroke-B2{stroke:#0D32B2;} + .d2-3469083568 .stroke-B3{stroke:#E3E9FD;} + .d2-3469083568 .stroke-B4{stroke:#E3E9FD;} + .d2-3469083568 .stroke-B5{stroke:#EDF0FD;} + .d2-3469083568 .stroke-B6{stroke:#F7F8FE;} + .d2-3469083568 .stroke-AA2{stroke:#4A6FF3;} + .d2-3469083568 .stroke-AA4{stroke:#EDF0FD;} + .d2-3469083568 .stroke-AA5{stroke:#F7F8FE;} + .d2-3469083568 .stroke-AB4{stroke:#EDF0FD;} + .d2-3469083568 .stroke-AB5{stroke:#F7F8FE;} + .d2-3469083568 .background-color-N1{background-color:#0A0F25;} + .d2-3469083568 .background-color-N2{background-color:#676C7E;} + .d2-3469083568 .background-color-N3{background-color:#9499AB;} + .d2-3469083568 .background-color-N4{background-color:#CFD2DD;} + .d2-3469083568 .background-color-N5{background-color:#DEE1EB;} + .d2-3469083568 .background-color-N6{background-color:#EEF1F8;} + .d2-3469083568 .background-color-N7{background-color:#FFFFFF;} + .d2-3469083568 .background-color-B1{background-color:#0D32B2;} + .d2-3469083568 .background-color-B2{background-color:#0D32B2;} + .d2-3469083568 .background-color-B3{background-color:#E3E9FD;} + .d2-3469083568 .background-color-B4{background-color:#E3E9FD;} + .d2-3469083568 .background-color-B5{background-color:#EDF0FD;} + .d2-3469083568 .background-color-B6{background-color:#F7F8FE;} + .d2-3469083568 .background-color-AA2{background-color:#4A6FF3;} + .d2-3469083568 .background-color-AA4{background-color:#EDF0FD;} + .d2-3469083568 .background-color-AA5{background-color:#F7F8FE;} + .d2-3469083568 .background-color-AB4{background-color:#EDF0FD;} + .d2-3469083568 .background-color-AB5{background-color:#F7F8FE;} + .d2-3469083568 .color-N1{color:#0A0F25;} + .d2-3469083568 .color-N2{color:#676C7E;} + .d2-3469083568 .color-N3{color:#9499AB;} + .d2-3469083568 .color-N4{color:#CFD2DD;} + .d2-3469083568 .color-N5{color:#DEE1EB;} + .d2-3469083568 .color-N6{color:#EEF1F8;} + .d2-3469083568 .color-N7{color:#FFFFFF;} + .d2-3469083568 .color-B1{color:#0D32B2;} + .d2-3469083568 .color-B2{color:#0D32B2;} + .d2-3469083568 .color-B3{color:#E3E9FD;} + .d2-3469083568 .color-B4{color:#E3E9FD;} + .d2-3469083568 .color-B5{color:#EDF0FD;} + .d2-3469083568 .color-B6{color:#F7F8FE;} + .d2-3469083568 .color-AA2{color:#4A6FF3;} + .d2-3469083568 .color-AA4{color:#EDF0FD;} + .d2-3469083568 .color-AA5{color:#F7F8FE;} + .d2-3469083568 .color-AB4{color:#EDF0FD;} + .d2-3469083568 .color-AB5{color:#F7F8FE;}.appendix text.text{fill:#0A0F25}.md{--color-fg-default:#0A0F25;--color-fg-muted:#676C7E;--color-fg-subtle:#9499AB;--color-canvas-default:#FFFFFF;--color-canvas-subtle:#EEF1F8;--color-border-default:#0D32B2;--color-border-muted:#0D32B2;--color-neutral-muted:#EEF1F8;--color-accent-fg:#0D32B2;--color-accent-emphasis:#0D32B2;--color-attention-subtle:#676C7E;--color-danger-fg:red;}.sketch-overlay-B1{fill:url(#streaks-darker);mix-blend-mode:lighten}.sketch-overlay-B2{fill:url(#streaks-darker);mix-blend-mode:lighten}.sketch-overlay-B3{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-B4{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-B5{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-B6{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-AA2{fill:url(#streaks-dark);mix-blend-mode:overlay}.sketch-overlay-AA4{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-AA5{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-AB4{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-AB5{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-N1{fill:url(#streaks-darker);mix-blend-mode:lighten}.sketch-overlay-N2{fill:url(#streaks-dark);mix-blend-mode:overlay}.sketch-overlay-N3{fill:url(#streaks-normal);mix-blend-mode:color-burn}.sketch-overlay-N4{fill:url(#streaks-normal);mix-blend-mode:color-burn}.sketch-overlay-N5{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-N6{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-N7{fill:url(#streaks-bright);mix-blend-mode:darken}.light-code{display: block}.dark-code{display: none}]]> + + + + + + + +abcdefgx + + + + + + + + + \ No newline at end of file diff --git a/e2etests/testdata/txtar/bidirectional_connection_animation/elk/board.exp.json b/e2etests/testdata/txtar/bidirectional_connection_animation/elk/board.exp.json index 85d12fc27..9eadf807d 100644 --- a/e2etests/testdata/txtar/bidirectional_connection_animation/elk/board.exp.json +++ b/e2etests/testdata/txtar/bidirectional_connection_animation/elk/board.exp.json @@ -1,13 +1,21 @@ { "name": "", + "config": { + "sketch": true, + "themeID": null, + "darkThemeID": null, + "pad": null, + "center": null, + "layoutEngine": null + }, "isFolderOnly": false, - "fontFamily": "SourceSansPro", + "fontFamily": "HandDrawn", "shapes": [ { "id": "a", "type": "rectangle", "pos": { - "x": 68, + "x": 71, "y": 12 }, "width": 160, @@ -38,7 +46,7 @@ "italic": false, "bold": true, "underline": false, - "labelWidth": 8, + "labelWidth": 9, "labelHeight": 21, "labelPosition": "INSIDE_MIDDLE_CENTER", "zIndex": 0, @@ -51,7 +59,7 @@ "x": 12, "y": 208 }, - "width": 53, + "width": 55, "height": 66, "opacity": 1, "strokeDash": 0, @@ -79,7 +87,7 @@ "italic": false, "bold": true, "underline": false, - "labelWidth": 8, + "labelWidth": 10, "labelHeight": 21, "labelPosition": "INSIDE_MIDDLE_CENTER", "zIndex": 0, @@ -89,10 +97,10 @@ "id": "c", "type": "rectangle", "pos": { - "x": 85, + "x": 87, "y": 208 }, - "width": 53, + "width": 54, "height": 66, "opacity": 1, "strokeDash": 0, @@ -120,7 +128,7 @@ "italic": false, "bold": true, "underline": false, - "labelWidth": 8, + "labelWidth": 9, "labelHeight": 21, "labelPosition": "INSIDE_MIDDLE_CENTER", "zIndex": 0, @@ -130,10 +138,10 @@ "id": "d", "type": "rectangle", "pos": { - "x": 158, + "x": 161, "y": 208 }, - "width": 54, + "width": 55, "height": 66, "opacity": 1, "strokeDash": 0, @@ -161,7 +169,7 @@ "italic": false, "bold": true, "underline": false, - "labelWidth": 9, + "labelWidth": 10, "labelHeight": 21, "labelPosition": "INSIDE_MIDDLE_CENTER", "zIndex": 0, @@ -171,7 +179,7 @@ "id": "e", "type": "rectangle", "pos": { - "x": 232, + "x": 236, "y": 208 }, "width": 53, @@ -212,10 +220,10 @@ "id": "f", "type": "rectangle", "pos": { - "x": 306, + "x": 309, "y": 12 }, - "width": 51, + "width": 54, "height": 66, "opacity": 1, "strokeDash": 0, @@ -243,7 +251,7 @@ "italic": false, "bold": true, "underline": false, - "labelWidth": 6, + "labelWidth": 9, "labelHeight": 21, "labelPosition": "INSIDE_MIDDLE_CENTER", "zIndex": 0, @@ -253,7 +261,7 @@ "id": "g", "type": "rectangle", "pos": { - "x": 305, + "x": 309, "y": 208 }, "width": 54, @@ -294,10 +302,10 @@ "id": "x", "type": "rectangle", "pos": { - "x": 427, + "x": 433, "y": 12 }, - "width": 53, + "width": 54, "height": 66, "opacity": 1, "strokeDash": 0, @@ -325,7 +333,7 @@ "italic": false, "bold": true, "underline": false, - "labelWidth": 8, + "labelWidth": 9, "labelHeight": 21, "labelPosition": "INSIDE_MIDDLE_CENTER", "zIndex": 0, @@ -358,19 +366,19 @@ "labelPercentage": 0, "route": [ { - "x": 100.25, + "x": 103.25, "y": 78 }, { - "x": 100.25, + "x": 103.25, "y": 118 }, { - "x": 38.5, + "x": 39.5, "y": 118 }, { - "x": 38.5, + "x": 39.5, "y": 208 } ], @@ -404,19 +412,19 @@ "labelPercentage": 0, "route": [ { - "x": 132.25, + "x": 135.25, "y": 78 }, { - "x": 132.25, + "x": 135.25, "y": 168 }, { - "x": 111.5, + "x": 114, "y": 168 }, { - "x": 111.5, + "x": 114, "y": 208 } ], @@ -450,19 +458,19 @@ "labelPercentage": 0, "route": [ { - "x": 164.25, + "x": 167.25, "y": 78 }, { - "x": 164.25, + "x": 167.25, "y": 168 }, { - "x": 185, + "x": 188.5, "y": 168 }, { - "x": 185, + "x": 188.5, "y": 208 } ], @@ -496,19 +504,19 @@ "labelPercentage": 0, "route": [ { - "x": 196.25, + "x": 199.25, "y": 78 }, { - "x": 196.25, + "x": 199.25, "y": 118 }, { - "x": 258.5, + "x": 262.5, "y": 118 }, { - "x": 258.5, + "x": 262.5, "y": 208 } ], @@ -542,11 +550,11 @@ "labelPercentage": 0, "route": [ { - "x": 332, + "x": 336, "y": 78 }, { - "x": 332, + "x": 336, "y": 208 } ], @@ -580,19 +588,19 @@ "labelPercentage": 0, "route": [ { - "x": 427.5, + "x": 433, "y": 34 }, { - "x": 377.5, + "x": 383, "y": 34 }, { - "x": 377.5, + "x": 383, "y": 56 }, { - "x": 427.5, + "x": 433, "y": 56 } ], diff --git a/e2etests/testdata/txtar/bidirectional_connection_animation/elk/sketch.exp.svg b/e2etests/testdata/txtar/bidirectional_connection_animation/elk/sketch.exp.svg index 5bdfdd2c5..4c6c71efb 100644 --- a/e2etests/testdata/txtar/bidirectional_connection_animation/elk/sketch.exp.svg +++ b/e2etests/testdata/txtar/bidirectional_connection_animation/elk/sketch.exp.svg @@ -1,16 +1,16 @@ -abcdefgx - - - - - - - - - + .d2-2501036534 .fill-N1{fill:#0A0F25;} + .d2-2501036534 .fill-N2{fill:#676C7E;} + .d2-2501036534 .fill-N3{fill:#9499AB;} + .d2-2501036534 .fill-N4{fill:#CFD2DD;} + .d2-2501036534 .fill-N5{fill:#DEE1EB;} + .d2-2501036534 .fill-N6{fill:#EEF1F8;} + .d2-2501036534 .fill-N7{fill:#FFFFFF;} + .d2-2501036534 .fill-B1{fill:#0D32B2;} + .d2-2501036534 .fill-B2{fill:#0D32B2;} + .d2-2501036534 .fill-B3{fill:#E3E9FD;} + .d2-2501036534 .fill-B4{fill:#E3E9FD;} + .d2-2501036534 .fill-B5{fill:#EDF0FD;} + .d2-2501036534 .fill-B6{fill:#F7F8FE;} + .d2-2501036534 .fill-AA2{fill:#4A6FF3;} + .d2-2501036534 .fill-AA4{fill:#EDF0FD;} + .d2-2501036534 .fill-AA5{fill:#F7F8FE;} + .d2-2501036534 .fill-AB4{fill:#EDF0FD;} + .d2-2501036534 .fill-AB5{fill:#F7F8FE;} + .d2-2501036534 .stroke-N1{stroke:#0A0F25;} + .d2-2501036534 .stroke-N2{stroke:#676C7E;} + .d2-2501036534 .stroke-N3{stroke:#9499AB;} + .d2-2501036534 .stroke-N4{stroke:#CFD2DD;} + .d2-2501036534 .stroke-N5{stroke:#DEE1EB;} + .d2-2501036534 .stroke-N6{stroke:#EEF1F8;} + .d2-2501036534 .stroke-N7{stroke:#FFFFFF;} + .d2-2501036534 .stroke-B1{stroke:#0D32B2;} + .d2-2501036534 .stroke-B2{stroke:#0D32B2;} + .d2-2501036534 .stroke-B3{stroke:#E3E9FD;} + .d2-2501036534 .stroke-B4{stroke:#E3E9FD;} + .d2-2501036534 .stroke-B5{stroke:#EDF0FD;} + .d2-2501036534 .stroke-B6{stroke:#F7F8FE;} + .d2-2501036534 .stroke-AA2{stroke:#4A6FF3;} + .d2-2501036534 .stroke-AA4{stroke:#EDF0FD;} + .d2-2501036534 .stroke-AA5{stroke:#F7F8FE;} + .d2-2501036534 .stroke-AB4{stroke:#EDF0FD;} + .d2-2501036534 .stroke-AB5{stroke:#F7F8FE;} + .d2-2501036534 .background-color-N1{background-color:#0A0F25;} + .d2-2501036534 .background-color-N2{background-color:#676C7E;} + .d2-2501036534 .background-color-N3{background-color:#9499AB;} + .d2-2501036534 .background-color-N4{background-color:#CFD2DD;} + .d2-2501036534 .background-color-N5{background-color:#DEE1EB;} + .d2-2501036534 .background-color-N6{background-color:#EEF1F8;} + .d2-2501036534 .background-color-N7{background-color:#FFFFFF;} + .d2-2501036534 .background-color-B1{background-color:#0D32B2;} + .d2-2501036534 .background-color-B2{background-color:#0D32B2;} + .d2-2501036534 .background-color-B3{background-color:#E3E9FD;} + .d2-2501036534 .background-color-B4{background-color:#E3E9FD;} + .d2-2501036534 .background-color-B5{background-color:#EDF0FD;} + .d2-2501036534 .background-color-B6{background-color:#F7F8FE;} + .d2-2501036534 .background-color-AA2{background-color:#4A6FF3;} + .d2-2501036534 .background-color-AA4{background-color:#EDF0FD;} + .d2-2501036534 .background-color-AA5{background-color:#F7F8FE;} + .d2-2501036534 .background-color-AB4{background-color:#EDF0FD;} + .d2-2501036534 .background-color-AB5{background-color:#F7F8FE;} + .d2-2501036534 .color-N1{color:#0A0F25;} + .d2-2501036534 .color-N2{color:#676C7E;} + .d2-2501036534 .color-N3{color:#9499AB;} + .d2-2501036534 .color-N4{color:#CFD2DD;} + .d2-2501036534 .color-N5{color:#DEE1EB;} + .d2-2501036534 .color-N6{color:#EEF1F8;} + .d2-2501036534 .color-N7{color:#FFFFFF;} + .d2-2501036534 .color-B1{color:#0D32B2;} + .d2-2501036534 .color-B2{color:#0D32B2;} + .d2-2501036534 .color-B3{color:#E3E9FD;} + .d2-2501036534 .color-B4{color:#E3E9FD;} + .d2-2501036534 .color-B5{color:#EDF0FD;} + .d2-2501036534 .color-B6{color:#F7F8FE;} + .d2-2501036534 .color-AA2{color:#4A6FF3;} + .d2-2501036534 .color-AA4{color:#EDF0FD;} + .d2-2501036534 .color-AA5{color:#F7F8FE;} + .d2-2501036534 .color-AB4{color:#EDF0FD;} + .d2-2501036534 .color-AB5{color:#F7F8FE;}.appendix text.text{fill:#0A0F25}.md{--color-fg-default:#0A0F25;--color-fg-muted:#676C7E;--color-fg-subtle:#9499AB;--color-canvas-default:#FFFFFF;--color-canvas-subtle:#EEF1F8;--color-border-default:#0D32B2;--color-border-muted:#0D32B2;--color-neutral-muted:#EEF1F8;--color-accent-fg:#0D32B2;--color-accent-emphasis:#0D32B2;--color-attention-subtle:#676C7E;--color-danger-fg:red;}.sketch-overlay-B1{fill:url(#streaks-darker);mix-blend-mode:lighten}.sketch-overlay-B2{fill:url(#streaks-darker);mix-blend-mode:lighten}.sketch-overlay-B3{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-B4{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-B5{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-B6{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-AA2{fill:url(#streaks-dark);mix-blend-mode:overlay}.sketch-overlay-AA4{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-AA5{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-AB4{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-AB5{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-N1{fill:url(#streaks-darker);mix-blend-mode:lighten}.sketch-overlay-N2{fill:url(#streaks-dark);mix-blend-mode:overlay}.sketch-overlay-N3{fill:url(#streaks-normal);mix-blend-mode:color-burn}.sketch-overlay-N4{fill:url(#streaks-normal);mix-blend-mode:color-burn}.sketch-overlay-N5{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-N6{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-N7{fill:url(#streaks-bright);mix-blend-mode:darken}.light-code{display: block}.dark-code{display: none}]]> + + + + + + + +abcdefgx + + + + + + + + + \ No newline at end of file diff --git a/lib/svg/path.go b/lib/svg/path.go index eddbb970f..f3d2d6606 100644 --- a/lib/svg/path.go +++ b/lib/svg/path.go @@ -3,6 +3,7 @@ package svg import ( "fmt" "math" + "strconv" "strings" "oss.terrastruct.com/d2/lib/geo" @@ -139,3 +140,181 @@ func BezierCurveSegment(p1, p2, p3, p4 *geo.Point, t0, t1 float64) (geo.Point, g return q1, q2, q3, q4 } + +// Gets a certain line/curve's SVG path string. offsetIdx and pathData provides the points needed +func getSVGPathString(pathType string, offsetIdx int, pathData []string) (string, error) { + switch pathType { + case "M": + return fmt.Sprintf("M %s %s ", pathData[offsetIdx+1], pathData[offsetIdx+2]), nil + case "L": + return fmt.Sprintf("L %s %s ", pathData[offsetIdx+1], pathData[offsetIdx+2]), nil + case "C": + return fmt.Sprintf("C %s %s %s %s %s %s ", pathData[offsetIdx+1], pathData[offsetIdx+2], pathData[offsetIdx+3], pathData[offsetIdx+4], pathData[offsetIdx+5], pathData[offsetIdx+6]), nil + case "S": + return fmt.Sprintf("S %s %s %s %s ", pathData[offsetIdx+1], pathData[offsetIdx+2], pathData[offsetIdx+3], pathData[offsetIdx+4]), nil + default: + return "", fmt.Errorf("unknown svg path command \"%s\"", pathData[offsetIdx]) + } +} + +// Gets how much to increment by on an SVG string to get to the next path command +func getPathStringIncrement(pathType string) (int, error) { + switch pathType { + case "M": + return 3, nil + case "L": + return 3, nil + case "C": + return 7, nil + case "S": + return 5, nil + default: + return 0, fmt.Errorf("unknown svg path command \"%s\"", pathType) + } +} + +// This function finds the length of a path in SVG notation +func pathLength(pathData []string) (float64, error) { + var x, y, pathLength float64 + var prevPosition geo.Point + var increment int + + for i := 0; i < len(pathData); i += increment { + switch pathData[i] { + case "M": + x, _ = strconv.ParseFloat(pathData[i+1], 64) + y, _ = strconv.ParseFloat(pathData[i+2], 64) + case "L": + x, _ = strconv.ParseFloat(pathData[i+1], 64) + y, _ = strconv.ParseFloat(pathData[i+2], 64) + + pathLength += geo.EuclideanDistance(prevPosition.X, prevPosition.Y, x, y) + case "C": + x, _ = strconv.ParseFloat(pathData[i+5], 64) + y, _ = strconv.ParseFloat(pathData[i+6], 64) + + pathLength += geo.EuclideanDistance(prevPosition.X, prevPosition.Y, x, y) + case "S": + x, _ = strconv.ParseFloat(pathData[i+3], 64) + y, _ = strconv.ParseFloat(pathData[i+4], 64) + + pathLength += geo.EuclideanDistance(prevPosition.X, prevPosition.Y, x, y) + default: + fmt.Println("hello", pathData[i]) + return 0, fmt.Errorf("unknown svg path command \"%s\"", pathData[i]) + } + + prevPosition = geo.Point{X: x, Y: y} + + incr, err := getPathStringIncrement(pathData[i]) + + if err != nil { + return 0, err + } + + increment = incr + } + + return pathLength, nil +} + +// Splits an SVG path into two SVG paths, with the first path being ~{percentage}% of the path +func SplitPath(path string, percentage float64) (string, string, error) { + var sumPathLens, curPathLen, x, y float64 + var prevPosition geo.Point + var path1, path2 string + var increment int + + pastHalf := false + pathData := strings.Split(path, " ") + pathLen, err := pathLength(pathData) + fmt.Println("pathLen:", pathLen) + + if err != nil { + return "", "", err + } + + for i := 0; i < len(pathData); i += increment { + switch pathData[i] { + case "M": + x, _ = strconv.ParseFloat(pathData[i+1], 64) + y, _ = strconv.ParseFloat(pathData[i+2], 64) + + curPathLen = 0 + case "L": + x, _ = strconv.ParseFloat(pathData[i+1], 64) + y, _ = strconv.ParseFloat(pathData[i+2], 64) + + curPathLen = geo.EuclideanDistance(prevPosition.X, prevPosition.Y, x, y) + case "C": + x, _ = strconv.ParseFloat(pathData[i+5], 64) + y, _ = strconv.ParseFloat(pathData[i+6], 64) + + curPathLen = geo.EuclideanDistance(prevPosition.X, prevPosition.Y, x, y) + case "S": + x, _ = strconv.ParseFloat(pathData[i+3], 64) + y, _ = strconv.ParseFloat(pathData[i+4], 64) + + curPathLen = geo.EuclideanDistance(prevPosition.X, prevPosition.Y, x, y) + default: + return "", "", fmt.Errorf("unknown svg path command \"%s\"", pathData[i]) + } + + curPath, err := getSVGPathString(pathData[i], i, pathData) + if err != nil { + return "", "", err + } + + sumPathLens += curPathLen + + if pastHalf { // add to path2 + path2 += curPath + } else if sumPathLens < pathLen*percentage { // add to path1 + path1 += curPath + } else { // transition from path1 -> path2 + t := (pathLen*percentage - sumPathLens + curPathLen) / curPathLen + + switch pathData[i] { + case "M": + path2 += fmt.Sprintf("M %s %s ", pathData[i+3], pathData[i+4]) + case "L": + path1 += fmt.Sprintf("L %f %f ", (x-prevPosition.X)*t+prevPosition.X, (y-prevPosition.Y)*t+prevPosition.Y) + path2 += fmt.Sprintf("M %f %f L %f %f ", (x-prevPosition.X)*t+prevPosition.X, (y-prevPosition.Y)*t+prevPosition.Y, x, y) + case "C": + h1x, _ := strconv.ParseFloat(pathData[i+1], 64) + h1y, _ := strconv.ParseFloat(pathData[i+2], 64) + h2x, _ := strconv.ParseFloat(pathData[i+3], 64) + h2y, _ := strconv.ParseFloat(pathData[i+4], 64) + + heading1 := geo.Point{X: h1x, Y: h1y} + heading2 := geo.Point{X: h2x, Y: h2y} + nextPoint := geo.Point{X: x, Y: y} + + q1, q2, q3, q4 := BezierCurveSegment(&prevPosition, &heading1, &heading2, &nextPoint, 0, 0.5) + path1 += fmt.Sprintf("C %f %f %f %f %f %f ", q2.X, q2.Y, q3.X, q3.Y, q4.X, q4.Y) + + q1, q2, q3, q4 = BezierCurveSegment(&prevPosition, &heading1, &heading2, &nextPoint, 0.5, 1) + path2 += fmt.Sprintf("M %f %f C %f %f %f %f %f %f ", q1.X, q1.Y, q2.X, q2.Y, q3.X, q3.Y, q4.X, q4.Y) + case "S": + // Skip S curves because they are shorter and we can split along the connection to the next path instead + path1 += fmt.Sprintf("S %s %s %s %s ", pathData[i+1], pathData[i+2], pathData[i+3], pathData[i+4]) + path2 += fmt.Sprintf("M %s %s ", pathData[i+3], pathData[i+4]) + default: + return "", "", fmt.Errorf("unknown svg path command \"%s\"", pathData[i]) + } + + pastHalf = true + } + + incr, err := getPathStringIncrement(pathData[i]) + + if err != nil { + return "", "", err + } + + increment = incr + prevPosition = geo.Point{X: x, Y: y} + } + + return path1, path2, nil +} From aa8ce9463ee5de826c51a3e60bb68d3563f717d6 Mon Sep 17 00:00:00 2001 From: Daniel Suh <23denial@gmail.com> Date: Mon, 20 May 2024 12:43:47 -0400 Subject: [PATCH 2/8] pass e2e tests --- d2renderers/d2sketch/sketch.go | 98 ++- .../d2sketch/testdata/animated/sketch.exp.svg | 2 +- .../testdata/animated_dark/sketch.exp.svg | 2 +- .../TestCLI_E2E/internal_linked_pdf.exp.pdf | Bin 66068 -> 66068 bytes .../testdata/TestCLI_E2E/no-nav-pdf.exp.pdf | Bin 96034 -> 96034 bytes .../testdata/TestCLI_E2E/no-nav-pptx.exp.pptx | Bin 122127 -> 122131 bytes .../TestCLI_E2E/renamed-board.exp.pdf | Bin 109975 -> 109975 bytes .../testdata/TestCLI_E2E/theme-pdf.exp.pdf | Bin 17306 -> 17306 bytes e2etests/testdata/txtar.txt | 22 +- .../dagre/board.exp.json | 695 +++++++++++++++++ .../dagre/sketch.exp.svg | 108 +++ .../elk/board.exp.json | 645 ++++++++++++++++ .../elk/sketch.exp.svg | 108 +++ .../dagre/sketch.exp.svg | 2 +- .../elk/sketch.exp.svg | 2 +- .../dagre/board.exp.json | 703 ++++++++++++++++++ .../dagre/sketch.exp.svg | 116 +++ .../elk/board.exp.json | 653 ++++++++++++++++ .../elk/sketch.exp.svg | 116 +++ lib/svg/path.go | 2 - 20 files changed, 3208 insertions(+), 66 deletions(-) create mode 100644 e2etests/testdata/txtar/bidirectional-connection-animation/dagre/board.exp.json create mode 100644 e2etests/testdata/txtar/bidirectional-connection-animation/dagre/sketch.exp.svg create mode 100644 e2etests/testdata/txtar/bidirectional-connection-animation/elk/board.exp.json create mode 100644 e2etests/testdata/txtar/bidirectional-connection-animation/elk/sketch.exp.svg create mode 100644 e2etests/testdata/txtar/sketch-bidirectional-connection-animation/dagre/board.exp.json create mode 100644 e2etests/testdata/txtar/sketch-bidirectional-connection-animation/dagre/sketch.exp.svg create mode 100644 e2etests/testdata/txtar/sketch-bidirectional-connection-animation/elk/board.exp.json create mode 100644 e2etests/testdata/txtar/sketch-bidirectional-connection-animation/elk/sketch.exp.svg diff --git a/d2renderers/d2sketch/sketch.go b/d2renderers/d2sketch/sketch.go index 8c2ec056e..ea768d948 100644 --- a/d2renderers/d2sketch/sketch.go +++ b/d2renderers/d2sketch/sketch.go @@ -6,7 +6,6 @@ import ( "fmt" "regexp" "strings" - "unicode" _ "embed" @@ -322,76 +321,69 @@ func Paths(r *Runner, shape d2target.Shape, paths []string) (string, error) { } func Connection(r *Runner, connection d2target.Connection, path, attrs string) (string, error) { - roughness := 0.5 - js := fmt.Sprintf(`node = rc.path("%s", {roughness: %f, seed: 1});`, path, roughness) - paths, err := computeRoughPathData(r, js) - if err != nil { - return "", err - } - - finalPath := "" - - insertSpacesAfterLetters := func(s string) { - output := "" - for i := 0; i < len(s); i++ { - if s[i] != ',' { - output += string(s[i]) - } - if unicode.IsLetter(rune(s[i])) { - output += " " - } - } - fmt.Println("PATH", output) - finalPath += output - } - fmt.Println() - - for i := 0; i < len(paths); i++ { - insertSpacesAfterLetters(paths[i]) - } - animatedClass := "" if connection.Animated { animatedClass = " animated-connection" } // If connection is animated and bidirectional - if connection.Animated && ((connection.DstArrow == d2target.NoArrowhead && connection.SrcArrow == d2target.NoArrowhead) || (connection.DstArrow != d2target.NoArrowhead && connection.SrcArrow != d2target.NoArrowhead)) { - // There is no pure CSS way to animate bidirectional connections in two directions, so we split it up - path1, path2, err := svg.SplitPath(path, 0.5) + if connection.Animated { + if (connection.DstArrow == d2target.NoArrowhead && connection.SrcArrow == d2target.NoArrowhead) || (connection.DstArrow != d2target.NoArrowhead && connection.SrcArrow != d2target.NoArrowhead) { + // There is no pure CSS way to animate bidirectional connections in two directions, so we split it up + path1, path2, err := svg.SplitPath(path, 0.5) + if err != nil { + return "", err + } + + pathEl1 := d2themes.NewThemableElement("path") + pathEl1.D = path1 + pathEl1.Fill = color.None + pathEl1.Stroke = connection.Stroke + pathEl1.ClassName = fmt.Sprintf("connection%s", animatedClass) + pathEl1.Style = connection.CSSStyle() + pathEl1.Style += "animation-direction: reverse;" + pathEl1.Attributes = attrs + + pathEl2 := d2themes.NewThemableElement("path") + pathEl2.D = path2 + pathEl2.Fill = color.None + pathEl2.Stroke = connection.Stroke + pathEl2.ClassName = fmt.Sprintf("connection%s", animatedClass) + pathEl2.Style = connection.CSSStyle() + pathEl2.Attributes = attrs + return pathEl1.Render() + " " + pathEl2.Render(), nil + } else { + pathEl := d2themes.NewThemableElement("path") + pathEl.D = path + pathEl.Fill = color.None + pathEl.Stroke = connection.Stroke + pathEl.ClassName = fmt.Sprintf("connection%s", animatedClass) + pathEl.Style = connection.CSSStyle() + pathEl.Attributes = attrs + return pathEl.Render(), nil + } + } else { + roughness := 0.5 + js := fmt.Sprintf(`node = rc.path("%s", {roughness: %f, seed: 1});`, path, roughness) + paths, err := computeRoughPathData(r, js) if err != nil { return "", err } - pathEl1 := d2themes.NewThemableElement("path") - pathEl1.D = path1 - pathEl1.Fill = color.None - pathEl1.Stroke = connection.Stroke - pathEl1.ClassName = fmt.Sprintf("connection%s", animatedClass) - pathEl1.Style = connection.CSSStyle() - pathEl1.Style += "animation-direction: reverse;" - pathEl1.Attributes = attrs + output := "" - pathEl2 := d2themes.NewThemableElement("path") - pathEl2.D = path2 - pathEl2.Fill = color.None - pathEl2.Stroke = connection.Stroke - pathEl2.ClassName = fmt.Sprintf("connection%s", animatedClass) - pathEl2.Style = connection.CSSStyle() - pathEl2.Attributes = attrs - // return pathEl1.Render(), nil - return pathEl2.Render(), nil - // return pathEl1.Render() + " " + pathEl2.Render(), nil - } else { pathEl := d2themes.NewThemableElement("path") - pathEl.D = finalPath pathEl.Fill = color.None pathEl.Stroke = connection.Stroke pathEl.ClassName = fmt.Sprintf("connection%s", animatedClass) pathEl.Style = connection.CSSStyle() pathEl.Attributes = attrs - return pathEl.Render(), nil + for _, p := range paths { + pathEl.D = p + output += pathEl.Render() + } + return output, nil } } diff --git a/d2renderers/d2sketch/testdata/animated/sketch.exp.svg b/d2renderers/d2sketch/testdata/animated/sketch.exp.svg index fecf1bfd8..819d95394 100644 --- a/d2renderers/d2sketch/testdata/animated/sketch.exp.svg +++ b/d2renderers/d2sketch/testdata/animated/sketch.exp.svg @@ -110,7 +110,7 @@ -wintersummertreessnowsun +wintersummertreessnowsun diff --git a/d2renderers/d2sketch/testdata/animated_dark/sketch.exp.svg b/d2renderers/d2sketch/testdata/animated_dark/sketch.exp.svg index 1178e671f..4b24c1970 100644 --- a/d2renderers/d2sketch/testdata/animated_dark/sketch.exp.svg +++ b/d2renderers/d2sketch/testdata/animated_dark/sketch.exp.svg @@ -108,7 +108,7 @@ -wintersummertreessnowsun +wintersummertreessnowsun diff --git a/e2etests-cli/testdata/TestCLI_E2E/internal_linked_pdf.exp.pdf b/e2etests-cli/testdata/TestCLI_E2E/internal_linked_pdf.exp.pdf index 7c1a8847dd2ac8f9e0ca68c8b64454c881ad6aa4..0cdc62313ebfc74ccc5bfd27165fa0be382d4342 100644 GIT binary patch delta 185 zcmbQz!ZM|WWy1%F$?LioF&b?S?0M=x*)z=m$W@*^C#`7n?>mbWCf9WvO#UFTh|y&8 zWXWwllg;jcxXPR7q&-rZJom5jWWj$1lkfdCob33|n$dW2?LR|C!^!LarK*}585kOw z7@8Pqa_Rf#r?@1Rq$+5*SQ!}@nHa$3He3ETXVSK`v{Wzv0fjsTE-=H`)YQ}fP0ZBP M*wS+PY(~aP061zv!~g&Q delta 181 zcmbQz!ZM|WWy1%F$^6}m7>zb>>fYuvxgyg5$W`9F`^F=c$@jYqCV!Av#Avd4vgA|$ z$r(35T;S?HhsXOCOiJKW;C2!`_GWkc=Gyxsj4Q1=7yFgmWF1U zT>8HGDK3d6sR|k{Rz?O!CI)c1&6fYonY0ZpOcV@2Kp{_o3(PP!H8-$C6Eih4HaDI= In~|{+0AqbW8~^|S diff --git a/e2etests-cli/testdata/TestCLI_E2E/no-nav-pdf.exp.pdf b/e2etests-cli/testdata/TestCLI_E2E/no-nav-pdf.exp.pdf index 73d6e3754de3b03f34ccfa42dc02e1106a3ad970..f577774c3e1de114d89311eeb80e01d27d33e8f8 100644 GIT binary patch delta 55 zcmZ4Vj&;#H)`l&NN+qhMMh1pPCWgkAnq2z6`6(`mC8-J;E>=bcMkWSux$W*HjJKHp D-OUfb delta 55 zcmZ4Vj&;#H)`l&NN+qf$hUSKrCYFXKnq2z6`6(`mC8-J;E>=bcMkWSux$W*HjJKHp D;CT<( diff --git a/e2etests-cli/testdata/TestCLI_E2E/no-nav-pptx.exp.pptx b/e2etests-cli/testdata/TestCLI_E2E/no-nav-pptx.exp.pptx index cf1579ac5ebe9fbd46d2730a5db52a1a9aeeb295..2adb5e28d5956d553b099a2ea147da14e037039a 100644 GIT binary patch delta 482 zcmV<80UiF2x(AcG2Y|Ez7RP_jZreN%#P4|uf_I6O;_pL2*b2}FIW<6lx@fN~xsloM zAINoNy?r6NV(d1z9@jJT;|^(U?@rE=S4i0ezoT8tDFLs7Hh$dEultAQ10@-y*U|~ryA>`z&&qBo=Js?KGSXKvcGPfauKRJK<9Fmim+mJ>U zrFxMgu%7e(nFEwsqGSuSiIqw(uv%4YJSJNpS~0NTz++}z+c8?b2+8Gl14UuiWM^=W z@UDFouM($hs(G5GcDgP0p7V}4$9_oN|9vn&|Xy_J4!RdD5?OGZ7+%8ZXen`Z<1<9xZ=-(n3Vcs0vkZs>}wj_bPR zjn2hDlT$Y0{64Gl?e^3C{(%lX?>7zquj%=|>&2!M8{Y7Z;CwFG_X_d{+WlVY-`FeV zt(cMsV@UII^`+YNS2Fwx00960P)i30qNc06paB2?ahIRF0Ufv6$N{nw38JQ}yPyF8 Y0CAU<+yPJl#FysW0V4(^%K-oY0Qd&(fdBvi delta 473 zcmV;~0Ve*Fx(AQC2Y|Ez7RP_hZrd;rgztF@f_I6OVl)k5D?l6M)BpkMqP?=@MrI@a zfLuq?+ZUoMCT@M}aXhmhcSvh{H`#%_LQKZH9c^k(2{`4oas7^d+dotvDM=`umVD+U8taF|$AH;k4nLbU1PKz7(U*&3V! zT#T>g*~FAg36JAgkJmZga^A2Xk6*s#+Ldw3)hVD|9^Gms(BJ@_KjM}ZRm^n!`3n>l zd(|bNB1rVHb4upGs!x9b6~qh7qmMcf_BNy;sb~Tk@4BZ52^`8rkRBXFiJ-}7@IdZc zQjw)o5{&6~kgl(lxA~y=jB?l@6Fz!vo(Hxh|UDfJS!TGZ38RRN2wEeTx|FKufTQMaO zdLQTI(sQ-*FQfY%00960P)i30s#Lz`oB;p;Ww*h|0nZZ&s#Lz`oB;p;WtW-U0Z;+J Pm+IUBBL*PL0RR91`&i$R diff --git a/e2etests-cli/testdata/TestCLI_E2E/renamed-board.exp.pdf b/e2etests-cli/testdata/TestCLI_E2E/renamed-board.exp.pdf index 581e72d2a77bca16b0b2e4c6277e2d32a38184d9..8628441e39da91d8d9cb4e692eaace5947a46ef7 100644 GIT binary patch delta 70 zcmbP!n{E1SwuUW?Nh_yMUdd=MJz*uI;q=2R8854v8W|WGnHU;dYI5oO=BKzMmZU0Z UxL6q(7?~Kr<+kr$#dwDa0Fjm#QUCw| delta 70 zcmbP!n{E1SwuUW?Nh_yMS;?qBJz*uI(e%SB8854v7@8Yenphf|XmaWM=BKzMmZU0Z UxL6q(7?~Kr<+kr$#dwDa0F-wZZ2$lO diff --git a/e2etests-cli/testdata/TestCLI_E2E/theme-pdf.exp.pdf b/e2etests-cli/testdata/TestCLI_E2E/theme-pdf.exp.pdf index 01c7166e15d8e436c7ba1a17db06e0b1c1cb8e93..ffd681ab13e139e54fb0dfd923bc8e4b3cfd4071 100644 GIT binary patch delta 52 zcmbQ$&N!=`al dog3 } --- bidirectional_connection_animation -- -vars: { - d2-config: { - sketch: true - } -} - +-- bidirectional-connection-animation -- a <-> b: {style.animated: true} a <-> c: {style.animated: true} a <-> d: {style.animated: true} @@ -272,3 +266,17 @@ x <-> y <-> z: { } direction: right } + +-- sketch-bidirectional-connection-animation -- +vars: { + d2-config: { + sketch: true + } +} + +a <-> b: {style.animated: true} +a <-> c: {style.animated: true} +a <-> d: {style.animated: true} +a <-> e +f <-> g: {style.animated: true} +x -- x: {style.animated: true} \ No newline at end of file diff --git a/e2etests/testdata/txtar/bidirectional-connection-animation/dagre/board.exp.json b/e2etests/testdata/txtar/bidirectional-connection-animation/dagre/board.exp.json new file mode 100644 index 000000000..16c3d88b9 --- /dev/null +++ b/e2etests/testdata/txtar/bidirectional-connection-animation/dagre/board.exp.json @@ -0,0 +1,695 @@ +{ + "name": "", + "isFolderOnly": false, + "fontFamily": "SourceSansPro", + "shapes": [ + { + "id": "a", + "type": "rectangle", + "pos": { + "x": 170, + "y": 0 + }, + "width": 53, + "height": 66, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "B6", + "stroke": "B1", + "shadow": false, + "3d": false, + "multiple": false, + "double-border": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "a", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "N1", + "italic": false, + "bold": true, + "underline": false, + "labelWidth": 8, + "labelHeight": 21, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 0, + "level": 1 + }, + { + "id": "b", + "type": "rectangle", + "pos": { + "x": 0, + "y": 166 + }, + "width": 53, + "height": 66, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "B6", + "stroke": "B1", + "shadow": false, + "3d": false, + "multiple": false, + "double-border": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "b", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "N1", + "italic": false, + "bold": true, + "underline": false, + "labelWidth": 8, + "labelHeight": 21, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 0, + "level": 1 + }, + { + "id": "c", + "type": "rectangle", + "pos": { + "x": 113, + "y": 166 + }, + "width": 53, + "height": 66, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "B6", + "stroke": "B1", + "shadow": false, + "3d": false, + "multiple": false, + "double-border": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "c", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "N1", + "italic": false, + "bold": true, + "underline": false, + "labelWidth": 8, + "labelHeight": 21, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 0, + "level": 1 + }, + { + "id": "d", + "type": "rectangle", + "pos": { + "x": 226, + "y": 166 + }, + "width": 54, + "height": 66, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "B6", + "stroke": "B1", + "shadow": false, + "3d": false, + "multiple": false, + "double-border": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "d", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "N1", + "italic": false, + "bold": true, + "underline": false, + "labelWidth": 9, + "labelHeight": 21, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 0, + "level": 1 + }, + { + "id": "e", + "type": "rectangle", + "pos": { + "x": 340, + "y": 166 + }, + "width": 53, + "height": 66, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "B6", + "stroke": "B1", + "shadow": false, + "3d": false, + "multiple": false, + "double-border": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "e", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "N1", + "italic": false, + "bold": true, + "underline": false, + "labelWidth": 8, + "labelHeight": 21, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 0, + "level": 1 + }, + { + "id": "f", + "type": "rectangle", + "pos": { + "x": 455, + "y": 0 + }, + "width": 51, + "height": 66, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "B6", + "stroke": "B1", + "shadow": false, + "3d": false, + "multiple": false, + "double-border": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "f", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "N1", + "italic": false, + "bold": true, + "underline": false, + "labelWidth": 6, + "labelHeight": 21, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 0, + "level": 1 + }, + { + "id": "g", + "type": "rectangle", + "pos": { + "x": 453, + "y": 166 + }, + "width": 54, + "height": 66, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "B6", + "stroke": "B1", + "shadow": false, + "3d": false, + "multiple": false, + "double-border": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "g", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "N1", + "italic": false, + "bold": true, + "underline": false, + "labelWidth": 9, + "labelHeight": 21, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 0, + "level": 1 + }, + { + "id": "x", + "type": "rectangle", + "pos": { + "x": 566, + "y": 0 + }, + "width": 53, + "height": 66, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "B6", + "stroke": "B1", + "shadow": false, + "3d": false, + "multiple": false, + "double-border": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "x", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "N1", + "italic": false, + "bold": true, + "underline": false, + "labelWidth": 8, + "labelHeight": 21, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 0, + "level": 1 + } + ], + "connections": [ + { + "id": "(a <-> b)[0]", + "src": "a", + "srcArrow": "triangle", + "dst": "b", + "dstArrow": "triangle", + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "stroke": "B1", + "borderRadius": 10, + "label": "", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "N2", + "italic": true, + "bold": false, + "underline": false, + "labelWidth": 0, + "labelHeight": 0, + "labelPosition": "", + "labelPercentage": 0, + "route": [ + { + "x": 169.75, + "y": 45.957000732421875 + }, + { + "x": 55.14899826049805, + "y": 101.99099731445312 + }, + { + "x": 26.5, + "y": 126 + }, + { + "x": 26.5, + "y": 166 + } + ], + "isCurve": true, + "animated": true, + "tooltip": "", + "icon": null, + "zIndex": 0 + }, + { + "id": "(a <-> c)[0]", + "src": "a", + "srcArrow": "triangle", + "dst": "c", + "dstArrow": "triangle", + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "stroke": "B1", + "borderRadius": 10, + "label": "", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "N2", + "italic": true, + "bold": false, + "underline": false, + "labelWidth": 0, + "labelHeight": 0, + "labelPosition": "", + "labelPercentage": 0, + "route": [ + { + "x": 173.5, + "y": 66 + }, + { + "x": 146.3000030517578, + "y": 106 + }, + { + "x": 139.5, + "y": 126 + }, + { + "x": 139.5, + "y": 166 + } + ], + "isCurve": true, + "animated": true, + "tooltip": "", + "icon": null, + "zIndex": 0 + }, + { + "id": "(a <-> d)[0]", + "src": "a", + "srcArrow": "triangle", + "dst": "d", + "dstArrow": "triangle", + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "stroke": "B1", + "borderRadius": 10, + "label": "", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "N2", + "italic": true, + "bold": false, + "underline": false, + "labelWidth": 0, + "labelHeight": 0, + "labelPosition": "", + "labelPercentage": 0, + "route": [ + { + "x": 219, + "y": 66 + }, + { + "x": 246.1999969482422, + "y": 106 + }, + { + "x": 253, + "y": 126 + }, + { + "x": 253, + "y": 166 + } + ], + "isCurve": true, + "animated": true, + "tooltip": "", + "icon": null, + "zIndex": 0 + }, + { + "id": "(a <-> e)[0]", + "src": "a", + "srcArrow": "triangle", + "dst": "e", + "dstArrow": "triangle", + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "stroke": "B1", + "borderRadius": 10, + "label": "", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "N2", + "italic": true, + "bold": false, + "underline": false, + "labelWidth": 0, + "labelHeight": 0, + "labelPosition": "", + "labelPercentage": 0, + "route": [ + { + "x": 222.5, + "y": 46 + }, + { + "x": 337.70001220703125, + "y": 102 + }, + { + "x": 366.5, + "y": 126 + }, + { + "x": 366.5, + "y": 166 + } + ], + "isCurve": true, + "animated": true, + "tooltip": "", + "icon": null, + "zIndex": 0 + }, + { + "id": "(f <-> g)[0]", + "src": "f", + "srcArrow": "triangle", + "dst": "g", + "dstArrow": "triangle", + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "stroke": "B1", + "borderRadius": 10, + "label": "", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "N2", + "italic": true, + "bold": false, + "underline": false, + "labelWidth": 0, + "labelHeight": 0, + "labelPosition": "", + "labelPercentage": 0, + "route": [ + { + "x": 480, + "y": 66 + }, + { + "x": 480, + "y": 106 + }, + { + "x": 480, + "y": 126 + }, + { + "x": 480, + "y": 166 + } + ], + "isCurve": true, + "animated": true, + "tooltip": "", + "icon": null, + "zIndex": 0 + }, + { + "id": "(x -- x)[0]", + "src": "x", + "srcArrow": "none", + "dst": "x", + "dstArrow": "none", + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "stroke": "B1", + "borderRadius": 10, + "label": "", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "N2", + "italic": true, + "bold": false, + "underline": false, + "labelWidth": 0, + "labelHeight": 0, + "labelPosition": "", + "labelPercentage": 0, + "route": [ + { + "x": 619.166015625, + "y": 16 + }, + { + "x": 639.9660034179688, + "y": 3.1989998817443848 + }, + { + "x": 646.5, + "y": 0 + }, + { + "x": 648.5, + "y": 0 + }, + { + "x": 650.5, + "y": 0 + }, + { + "x": 653.166015625, + "y": 6.599999904632568 + }, + { + "x": 655.166015625, + "y": 16.5 + }, + { + "x": 657.166015625, + "y": 26.399999618530273 + }, + { + "x": 657.166015625, + "y": 39.599998474121094 + }, + { + "x": 655.166015625, + "y": 49.5 + }, + { + "x": 653.166015625, + "y": 59.400001525878906 + }, + { + "x": 639.9660034179688, + "y": 62.79999923706055 + }, + { + "x": 619.166015625, + "y": 50 + } + ], + "isCurve": true, + "animated": true, + "tooltip": "", + "icon": null, + "zIndex": 0 + } + ], + "root": { + "id": "", + "type": "", + "pos": { + "x": 0, + "y": 0 + }, + "width": 0, + "height": 0, + "opacity": 0, + "strokeDash": 0, + "strokeWidth": 0, + "borderRadius": 0, + "fill": "N7", + "stroke": "", + "shadow": false, + "3d": false, + "multiple": false, + "double-border": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "", + "fontSize": 0, + "fontFamily": "", + "language": "", + "color": "", + "italic": false, + "bold": false, + "underline": false, + "labelWidth": 0, + "labelHeight": 0, + "zIndex": 0, + "level": 0 + } +} diff --git a/e2etests/testdata/txtar/bidirectional-connection-animation/dagre/sketch.exp.svg b/e2etests/testdata/txtar/bidirectional-connection-animation/dagre/sketch.exp.svg new file mode 100644 index 000000000..030120280 --- /dev/null +++ b/e2etests/testdata/txtar/bidirectional-connection-animation/dagre/sketch.exp.svg @@ -0,0 +1,108 @@ +abcdefgx + + + + + + + + + + \ No newline at end of file diff --git a/e2etests/testdata/txtar/bidirectional-connection-animation/elk/board.exp.json b/e2etests/testdata/txtar/bidirectional-connection-animation/elk/board.exp.json new file mode 100644 index 000000000..85d12fc27 --- /dev/null +++ b/e2etests/testdata/txtar/bidirectional-connection-animation/elk/board.exp.json @@ -0,0 +1,645 @@ +{ + "name": "", + "isFolderOnly": false, + "fontFamily": "SourceSansPro", + "shapes": [ + { + "id": "a", + "type": "rectangle", + "pos": { + "x": 68, + "y": 12 + }, + "width": 160, + "height": 66, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "B6", + "stroke": "B1", + "shadow": false, + "3d": false, + "multiple": false, + "double-border": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "a", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "N1", + "italic": false, + "bold": true, + "underline": false, + "labelWidth": 8, + "labelHeight": 21, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 0, + "level": 1 + }, + { + "id": "b", + "type": "rectangle", + "pos": { + "x": 12, + "y": 208 + }, + "width": 53, + "height": 66, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "B6", + "stroke": "B1", + "shadow": false, + "3d": false, + "multiple": false, + "double-border": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "b", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "N1", + "italic": false, + "bold": true, + "underline": false, + "labelWidth": 8, + "labelHeight": 21, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 0, + "level": 1 + }, + { + "id": "c", + "type": "rectangle", + "pos": { + "x": 85, + "y": 208 + }, + "width": 53, + "height": 66, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "B6", + "stroke": "B1", + "shadow": false, + "3d": false, + "multiple": false, + "double-border": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "c", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "N1", + "italic": false, + "bold": true, + "underline": false, + "labelWidth": 8, + "labelHeight": 21, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 0, + "level": 1 + }, + { + "id": "d", + "type": "rectangle", + "pos": { + "x": 158, + "y": 208 + }, + "width": 54, + "height": 66, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "B6", + "stroke": "B1", + "shadow": false, + "3d": false, + "multiple": false, + "double-border": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "d", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "N1", + "italic": false, + "bold": true, + "underline": false, + "labelWidth": 9, + "labelHeight": 21, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 0, + "level": 1 + }, + { + "id": "e", + "type": "rectangle", + "pos": { + "x": 232, + "y": 208 + }, + "width": 53, + "height": 66, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "B6", + "stroke": "B1", + "shadow": false, + "3d": false, + "multiple": false, + "double-border": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "e", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "N1", + "italic": false, + "bold": true, + "underline": false, + "labelWidth": 8, + "labelHeight": 21, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 0, + "level": 1 + }, + { + "id": "f", + "type": "rectangle", + "pos": { + "x": 306, + "y": 12 + }, + "width": 51, + "height": 66, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "B6", + "stroke": "B1", + "shadow": false, + "3d": false, + "multiple": false, + "double-border": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "f", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "N1", + "italic": false, + "bold": true, + "underline": false, + "labelWidth": 6, + "labelHeight": 21, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 0, + "level": 1 + }, + { + "id": "g", + "type": "rectangle", + "pos": { + "x": 305, + "y": 208 + }, + "width": 54, + "height": 66, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "B6", + "stroke": "B1", + "shadow": false, + "3d": false, + "multiple": false, + "double-border": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "g", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "N1", + "italic": false, + "bold": true, + "underline": false, + "labelWidth": 9, + "labelHeight": 21, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 0, + "level": 1 + }, + { + "id": "x", + "type": "rectangle", + "pos": { + "x": 427, + "y": 12 + }, + "width": 53, + "height": 66, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "B6", + "stroke": "B1", + "shadow": false, + "3d": false, + "multiple": false, + "double-border": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "x", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "N1", + "italic": false, + "bold": true, + "underline": false, + "labelWidth": 8, + "labelHeight": 21, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 0, + "level": 1 + } + ], + "connections": [ + { + "id": "(a <-> b)[0]", + "src": "a", + "srcArrow": "triangle", + "dst": "b", + "dstArrow": "triangle", + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "stroke": "B1", + "borderRadius": 10, + "label": "", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "N2", + "italic": true, + "bold": false, + "underline": false, + "labelWidth": 0, + "labelHeight": 0, + "labelPosition": "", + "labelPercentage": 0, + "route": [ + { + "x": 100.25, + "y": 78 + }, + { + "x": 100.25, + "y": 118 + }, + { + "x": 38.5, + "y": 118 + }, + { + "x": 38.5, + "y": 208 + } + ], + "animated": true, + "tooltip": "", + "icon": null, + "zIndex": 0 + }, + { + "id": "(a <-> c)[0]", + "src": "a", + "srcArrow": "triangle", + "dst": "c", + "dstArrow": "triangle", + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "stroke": "B1", + "borderRadius": 10, + "label": "", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "N2", + "italic": true, + "bold": false, + "underline": false, + "labelWidth": 0, + "labelHeight": 0, + "labelPosition": "", + "labelPercentage": 0, + "route": [ + { + "x": 132.25, + "y": 78 + }, + { + "x": 132.25, + "y": 168 + }, + { + "x": 111.5, + "y": 168 + }, + { + "x": 111.5, + "y": 208 + } + ], + "animated": true, + "tooltip": "", + "icon": null, + "zIndex": 0 + }, + { + "id": "(a <-> d)[0]", + "src": "a", + "srcArrow": "triangle", + "dst": "d", + "dstArrow": "triangle", + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "stroke": "B1", + "borderRadius": 10, + "label": "", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "N2", + "italic": true, + "bold": false, + "underline": false, + "labelWidth": 0, + "labelHeight": 0, + "labelPosition": "", + "labelPercentage": 0, + "route": [ + { + "x": 164.25, + "y": 78 + }, + { + "x": 164.25, + "y": 168 + }, + { + "x": 185, + "y": 168 + }, + { + "x": 185, + "y": 208 + } + ], + "animated": true, + "tooltip": "", + "icon": null, + "zIndex": 0 + }, + { + "id": "(a <-> e)[0]", + "src": "a", + "srcArrow": "triangle", + "dst": "e", + "dstArrow": "triangle", + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "stroke": "B1", + "borderRadius": 10, + "label": "", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "N2", + "italic": true, + "bold": false, + "underline": false, + "labelWidth": 0, + "labelHeight": 0, + "labelPosition": "", + "labelPercentage": 0, + "route": [ + { + "x": 196.25, + "y": 78 + }, + { + "x": 196.25, + "y": 118 + }, + { + "x": 258.5, + "y": 118 + }, + { + "x": 258.5, + "y": 208 + } + ], + "animated": true, + "tooltip": "", + "icon": null, + "zIndex": 0 + }, + { + "id": "(f <-> g)[0]", + "src": "f", + "srcArrow": "triangle", + "dst": "g", + "dstArrow": "triangle", + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "stroke": "B1", + "borderRadius": 10, + "label": "", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "N2", + "italic": true, + "bold": false, + "underline": false, + "labelWidth": 0, + "labelHeight": 0, + "labelPosition": "", + "labelPercentage": 0, + "route": [ + { + "x": 332, + "y": 78 + }, + { + "x": 332, + "y": 208 + } + ], + "animated": true, + "tooltip": "", + "icon": null, + "zIndex": 0 + }, + { + "id": "(x -- x)[0]", + "src": "x", + "srcArrow": "none", + "dst": "x", + "dstArrow": "none", + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "stroke": "B1", + "borderRadius": 10, + "label": "", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "N2", + "italic": true, + "bold": false, + "underline": false, + "labelWidth": 0, + "labelHeight": 0, + "labelPosition": "", + "labelPercentage": 0, + "route": [ + { + "x": 427.5, + "y": 34 + }, + { + "x": 377.5, + "y": 34 + }, + { + "x": 377.5, + "y": 56 + }, + { + "x": 427.5, + "y": 56 + } + ], + "animated": true, + "tooltip": "", + "icon": null, + "zIndex": 0 + } + ], + "root": { + "id": "", + "type": "", + "pos": { + "x": 0, + "y": 0 + }, + "width": 0, + "height": 0, + "opacity": 0, + "strokeDash": 0, + "strokeWidth": 0, + "borderRadius": 0, + "fill": "N7", + "stroke": "", + "shadow": false, + "3d": false, + "multiple": false, + "double-border": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "", + "fontSize": 0, + "fontFamily": "", + "language": "", + "color": "", + "italic": false, + "bold": false, + "underline": false, + "labelWidth": 0, + "labelHeight": 0, + "zIndex": 0, + "level": 0 + } +} diff --git a/e2etests/testdata/txtar/bidirectional-connection-animation/elk/sketch.exp.svg b/e2etests/testdata/txtar/bidirectional-connection-animation/elk/sketch.exp.svg new file mode 100644 index 000000000..5bdfdd2c5 --- /dev/null +++ b/e2etests/testdata/txtar/bidirectional-connection-animation/elk/sketch.exp.svg @@ -0,0 +1,108 @@ +abcdefgx + + + + + + + + + + \ No newline at end of file diff --git a/e2etests/testdata/txtar/bidirectional_connection_animation/dagre/sketch.exp.svg b/e2etests/testdata/txtar/bidirectional_connection_animation/dagre/sketch.exp.svg index 02f9b9fa1..8feb1399c 100644 --- a/e2etests/testdata/txtar/bidirectional_connection_animation/dagre/sketch.exp.svg +++ b/e2etests/testdata/txtar/bidirectional_connection_animation/dagre/sketch.exp.svg @@ -103,7 +103,7 @@ -abcdefgx +abcdefgx diff --git a/e2etests/testdata/txtar/bidirectional_connection_animation/elk/sketch.exp.svg b/e2etests/testdata/txtar/bidirectional_connection_animation/elk/sketch.exp.svg index 4c6c71efb..85a25830d 100644 --- a/e2etests/testdata/txtar/bidirectional_connection_animation/elk/sketch.exp.svg +++ b/e2etests/testdata/txtar/bidirectional_connection_animation/elk/sketch.exp.svg @@ -103,7 +103,7 @@ -abcdefgx +abcdefgx diff --git a/e2etests/testdata/txtar/sketch-bidirectional-connection-animation/dagre/board.exp.json b/e2etests/testdata/txtar/sketch-bidirectional-connection-animation/dagre/board.exp.json new file mode 100644 index 000000000..d4be34b71 --- /dev/null +++ b/e2etests/testdata/txtar/sketch-bidirectional-connection-animation/dagre/board.exp.json @@ -0,0 +1,703 @@ +{ + "name": "", + "config": { + "sketch": true, + "themeID": null, + "darkThemeID": null, + "pad": null, + "center": null, + "layoutEngine": null + }, + "isFolderOnly": false, + "fontFamily": "HandDrawn", + "shapes": [ + { + "id": "a", + "type": "rectangle", + "pos": { + "x": 172, + "y": 0 + }, + "width": 54, + "height": 66, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "B6", + "stroke": "B1", + "shadow": false, + "3d": false, + "multiple": false, + "double-border": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "a", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "N1", + "italic": false, + "bold": true, + "underline": false, + "labelWidth": 9, + "labelHeight": 21, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 0, + "level": 1 + }, + { + "id": "b", + "type": "rectangle", + "pos": { + "x": 0, + "y": 166 + }, + "width": 55, + "height": 66, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "B6", + "stroke": "B1", + "shadow": false, + "3d": false, + "multiple": false, + "double-border": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "b", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "N1", + "italic": false, + "bold": true, + "underline": false, + "labelWidth": 10, + "labelHeight": 21, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 0, + "level": 1 + }, + { + "id": "c", + "type": "rectangle", + "pos": { + "x": 115, + "y": 166 + }, + "width": 54, + "height": 66, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "B6", + "stroke": "B1", + "shadow": false, + "3d": false, + "multiple": false, + "double-border": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "c", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "N1", + "italic": false, + "bold": true, + "underline": false, + "labelWidth": 9, + "labelHeight": 21, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 0, + "level": 1 + }, + { + "id": "d", + "type": "rectangle", + "pos": { + "x": 229, + "y": 166 + }, + "width": 55, + "height": 66, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "B6", + "stroke": "B1", + "shadow": false, + "3d": false, + "multiple": false, + "double-border": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "d", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "N1", + "italic": false, + "bold": true, + "underline": false, + "labelWidth": 10, + "labelHeight": 21, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 0, + "level": 1 + }, + { + "id": "e", + "type": "rectangle", + "pos": { + "x": 344, + "y": 166 + }, + "width": 53, + "height": 66, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "B6", + "stroke": "B1", + "shadow": false, + "3d": false, + "multiple": false, + "double-border": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "e", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "N1", + "italic": false, + "bold": true, + "underline": false, + "labelWidth": 8, + "labelHeight": 21, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 0, + "level": 1 + }, + { + "id": "f", + "type": "rectangle", + "pos": { + "x": 457, + "y": 0 + }, + "width": 54, + "height": 66, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "B6", + "stroke": "B1", + "shadow": false, + "3d": false, + "multiple": false, + "double-border": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "f", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "N1", + "italic": false, + "bold": true, + "underline": false, + "labelWidth": 9, + "labelHeight": 21, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 0, + "level": 1 + }, + { + "id": "g", + "type": "rectangle", + "pos": { + "x": 457, + "y": 166 + }, + "width": 54, + "height": 66, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "B6", + "stroke": "B1", + "shadow": false, + "3d": false, + "multiple": false, + "double-border": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "g", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "N1", + "italic": false, + "bold": true, + "underline": false, + "labelWidth": 9, + "labelHeight": 21, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 0, + "level": 1 + }, + { + "id": "x", + "type": "rectangle", + "pos": { + "x": 571, + "y": 0 + }, + "width": 54, + "height": 66, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "B6", + "stroke": "B1", + "shadow": false, + "3d": false, + "multiple": false, + "double-border": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "x", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "N1", + "italic": false, + "bold": true, + "underline": false, + "labelWidth": 9, + "labelHeight": 21, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 0, + "level": 1 + } + ], + "connections": [ + { + "id": "(a <-> b)[0]", + "src": "a", + "srcArrow": "triangle", + "dst": "b", + "dstArrow": "triangle", + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "stroke": "B1", + "borderRadius": 10, + "label": "", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "N2", + "italic": true, + "bold": false, + "underline": false, + "labelWidth": 0, + "labelHeight": 0, + "labelPosition": "", + "labelPercentage": 0, + "route": [ + { + "x": 172.5, + "y": 46 + }, + { + "x": 56.5, + "y": 102 + }, + { + "x": 27.5, + "y": 126 + }, + { + "x": 27.5, + "y": 166 + } + ], + "isCurve": true, + "animated": true, + "tooltip": "", + "icon": null, + "zIndex": 0 + }, + { + "id": "(a <-> c)[0]", + "src": "a", + "srcArrow": "triangle", + "dst": "c", + "dstArrow": "triangle", + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "stroke": "B1", + "borderRadius": 10, + "label": "", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "N2", + "italic": true, + "bold": false, + "underline": false, + "labelWidth": 0, + "labelHeight": 0, + "labelPosition": "", + "labelPercentage": 0, + "route": [ + { + "x": 176, + "y": 66 + }, + { + "x": 148.8000030517578, + "y": 106 + }, + { + "x": 142, + "y": 126 + }, + { + "x": 142, + "y": 166 + } + ], + "isCurve": true, + "animated": true, + "tooltip": "", + "icon": null, + "zIndex": 0 + }, + { + "id": "(a <-> d)[0]", + "src": "a", + "srcArrow": "triangle", + "dst": "d", + "dstArrow": "triangle", + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "stroke": "B1", + "borderRadius": 10, + "label": "", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "N2", + "italic": true, + "bold": false, + "underline": false, + "labelWidth": 0, + "labelHeight": 0, + "labelPosition": "", + "labelPercentage": 0, + "route": [ + { + "x": 222.5, + "y": 66 + }, + { + "x": 249.6999969482422, + "y": 106 + }, + { + "x": 256.5, + "y": 126 + }, + { + "x": 256.5, + "y": 166 + } + ], + "isCurve": true, + "animated": true, + "tooltip": "", + "icon": null, + "zIndex": 0 + }, + { + "id": "(a <-> e)[0]", + "src": "a", + "srcArrow": "triangle", + "dst": "e", + "dstArrow": "triangle", + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "stroke": "B1", + "borderRadius": 10, + "label": "", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "N2", + "italic": true, + "bold": false, + "underline": false, + "labelWidth": 0, + "labelHeight": 0, + "labelPosition": "", + "labelPercentage": 0, + "route": [ + { + "x": 226.25, + "y": 46.08599853515625 + }, + { + "x": 341.6499938964844, + "y": 102.01699829101562 + }, + { + "x": 370.5, + "y": 126 + }, + { + "x": 370.5, + "y": 166 + } + ], + "isCurve": true, + "animated": false, + "tooltip": "", + "icon": null, + "zIndex": 0 + }, + { + "id": "(f <-> g)[0]", + "src": "f", + "srcArrow": "triangle", + "dst": "g", + "dstArrow": "triangle", + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "stroke": "B1", + "borderRadius": 10, + "label": "", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "N2", + "italic": true, + "bold": false, + "underline": false, + "labelWidth": 0, + "labelHeight": 0, + "labelPosition": "", + "labelPercentage": 0, + "route": [ + { + "x": 484, + "y": 66 + }, + { + "x": 484, + "y": 106 + }, + { + "x": 484, + "y": 126 + }, + { + "x": 484, + "y": 166 + } + ], + "isCurve": true, + "animated": true, + "tooltip": "", + "icon": null, + "zIndex": 0 + }, + { + "id": "(x -- x)[0]", + "src": "x", + "srcArrow": "none", + "dst": "x", + "dstArrow": "none", + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "stroke": "B1", + "borderRadius": 10, + "label": "", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "N2", + "italic": true, + "bold": false, + "underline": false, + "labelWidth": 0, + "labelHeight": 0, + "labelPosition": "", + "labelPercentage": 0, + "route": [ + { + "x": 624.666015625, + "y": 16 + }, + { + "x": 646.2659912109375, + "y": 3.1989998817443848 + }, + { + "x": 653, + "y": 0 + }, + { + "x": 655, + "y": 0 + }, + { + "x": 657, + "y": 0 + }, + { + "x": 659.666015625, + "y": 6.599999904632568 + }, + { + "x": 661.666015625, + "y": 16.5 + }, + { + "x": 663.666015625, + "y": 26.399999618530273 + }, + { + "x": 663.666015625, + "y": 39.599998474121094 + }, + { + "x": 661.666015625, + "y": 49.5 + }, + { + "x": 659.666015625, + "y": 59.400001525878906 + }, + { + "x": 646.2659912109375, + "y": 62.79999923706055 + }, + { + "x": 624.666015625, + "y": 50 + } + ], + "isCurve": true, + "animated": true, + "tooltip": "", + "icon": null, + "zIndex": 0 + } + ], + "root": { + "id": "", + "type": "", + "pos": { + "x": 0, + "y": 0 + }, + "width": 0, + "height": 0, + "opacity": 0, + "strokeDash": 0, + "strokeWidth": 0, + "borderRadius": 0, + "fill": "N7", + "stroke": "", + "shadow": false, + "3d": false, + "multiple": false, + "double-border": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "", + "fontSize": 0, + "fontFamily": "", + "language": "", + "color": "", + "italic": false, + "bold": false, + "underline": false, + "labelWidth": 0, + "labelHeight": 0, + "zIndex": 0, + "level": 0 + } +} diff --git a/e2etests/testdata/txtar/sketch-bidirectional-connection-animation/dagre/sketch.exp.svg b/e2etests/testdata/txtar/sketch-bidirectional-connection-animation/dagre/sketch.exp.svg new file mode 100644 index 000000000..01ae7f387 --- /dev/null +++ b/e2etests/testdata/txtar/sketch-bidirectional-connection-animation/dagre/sketch.exp.svg @@ -0,0 +1,116 @@ + + + + + + + + +abcdefgx + + + + + + + + + + \ No newline at end of file diff --git a/e2etests/testdata/txtar/sketch-bidirectional-connection-animation/elk/board.exp.json b/e2etests/testdata/txtar/sketch-bidirectional-connection-animation/elk/board.exp.json new file mode 100644 index 000000000..5abaaf205 --- /dev/null +++ b/e2etests/testdata/txtar/sketch-bidirectional-connection-animation/elk/board.exp.json @@ -0,0 +1,653 @@ +{ + "name": "", + "config": { + "sketch": true, + "themeID": null, + "darkThemeID": null, + "pad": null, + "center": null, + "layoutEngine": null + }, + "isFolderOnly": false, + "fontFamily": "HandDrawn", + "shapes": [ + { + "id": "a", + "type": "rectangle", + "pos": { + "x": 71, + "y": 12 + }, + "width": 160, + "height": 66, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "B6", + "stroke": "B1", + "shadow": false, + "3d": false, + "multiple": false, + "double-border": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "a", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "N1", + "italic": false, + "bold": true, + "underline": false, + "labelWidth": 9, + "labelHeight": 21, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 0, + "level": 1 + }, + { + "id": "b", + "type": "rectangle", + "pos": { + "x": 12, + "y": 208 + }, + "width": 55, + "height": 66, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "B6", + "stroke": "B1", + "shadow": false, + "3d": false, + "multiple": false, + "double-border": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "b", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "N1", + "italic": false, + "bold": true, + "underline": false, + "labelWidth": 10, + "labelHeight": 21, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 0, + "level": 1 + }, + { + "id": "c", + "type": "rectangle", + "pos": { + "x": 87, + "y": 208 + }, + "width": 54, + "height": 66, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "B6", + "stroke": "B1", + "shadow": false, + "3d": false, + "multiple": false, + "double-border": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "c", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "N1", + "italic": false, + "bold": true, + "underline": false, + "labelWidth": 9, + "labelHeight": 21, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 0, + "level": 1 + }, + { + "id": "d", + "type": "rectangle", + "pos": { + "x": 161, + "y": 208 + }, + "width": 55, + "height": 66, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "B6", + "stroke": "B1", + "shadow": false, + "3d": false, + "multiple": false, + "double-border": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "d", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "N1", + "italic": false, + "bold": true, + "underline": false, + "labelWidth": 10, + "labelHeight": 21, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 0, + "level": 1 + }, + { + "id": "e", + "type": "rectangle", + "pos": { + "x": 236, + "y": 208 + }, + "width": 53, + "height": 66, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "B6", + "stroke": "B1", + "shadow": false, + "3d": false, + "multiple": false, + "double-border": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "e", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "N1", + "italic": false, + "bold": true, + "underline": false, + "labelWidth": 8, + "labelHeight": 21, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 0, + "level": 1 + }, + { + "id": "f", + "type": "rectangle", + "pos": { + "x": 309, + "y": 12 + }, + "width": 54, + "height": 66, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "B6", + "stroke": "B1", + "shadow": false, + "3d": false, + "multiple": false, + "double-border": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "f", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "N1", + "italic": false, + "bold": true, + "underline": false, + "labelWidth": 9, + "labelHeight": 21, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 0, + "level": 1 + }, + { + "id": "g", + "type": "rectangle", + "pos": { + "x": 309, + "y": 208 + }, + "width": 54, + "height": 66, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "B6", + "stroke": "B1", + "shadow": false, + "3d": false, + "multiple": false, + "double-border": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "g", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "N1", + "italic": false, + "bold": true, + "underline": false, + "labelWidth": 9, + "labelHeight": 21, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 0, + "level": 1 + }, + { + "id": "x", + "type": "rectangle", + "pos": { + "x": 433, + "y": 12 + }, + "width": 54, + "height": 66, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "B6", + "stroke": "B1", + "shadow": false, + "3d": false, + "multiple": false, + "double-border": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "x", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "N1", + "italic": false, + "bold": true, + "underline": false, + "labelWidth": 9, + "labelHeight": 21, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 0, + "level": 1 + } + ], + "connections": [ + { + "id": "(a <-> b)[0]", + "src": "a", + "srcArrow": "triangle", + "dst": "b", + "dstArrow": "triangle", + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "stroke": "B1", + "borderRadius": 10, + "label": "", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "N2", + "italic": true, + "bold": false, + "underline": false, + "labelWidth": 0, + "labelHeight": 0, + "labelPosition": "", + "labelPercentage": 0, + "route": [ + { + "x": 103.25, + "y": 78 + }, + { + "x": 103.25, + "y": 118 + }, + { + "x": 39.5, + "y": 118 + }, + { + "x": 39.5, + "y": 208 + } + ], + "animated": true, + "tooltip": "", + "icon": null, + "zIndex": 0 + }, + { + "id": "(a <-> c)[0]", + "src": "a", + "srcArrow": "triangle", + "dst": "c", + "dstArrow": "triangle", + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "stroke": "B1", + "borderRadius": 10, + "label": "", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "N2", + "italic": true, + "bold": false, + "underline": false, + "labelWidth": 0, + "labelHeight": 0, + "labelPosition": "", + "labelPercentage": 0, + "route": [ + { + "x": 135.25, + "y": 78 + }, + { + "x": 135.25, + "y": 168 + }, + { + "x": 114, + "y": 168 + }, + { + "x": 114, + "y": 208 + } + ], + "animated": true, + "tooltip": "", + "icon": null, + "zIndex": 0 + }, + { + "id": "(a <-> d)[0]", + "src": "a", + "srcArrow": "triangle", + "dst": "d", + "dstArrow": "triangle", + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "stroke": "B1", + "borderRadius": 10, + "label": "", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "N2", + "italic": true, + "bold": false, + "underline": false, + "labelWidth": 0, + "labelHeight": 0, + "labelPosition": "", + "labelPercentage": 0, + "route": [ + { + "x": 167.25, + "y": 78 + }, + { + "x": 167.25, + "y": 168 + }, + { + "x": 188.5, + "y": 168 + }, + { + "x": 188.5, + "y": 208 + } + ], + "animated": true, + "tooltip": "", + "icon": null, + "zIndex": 0 + }, + { + "id": "(a <-> e)[0]", + "src": "a", + "srcArrow": "triangle", + "dst": "e", + "dstArrow": "triangle", + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "stroke": "B1", + "borderRadius": 10, + "label": "", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "N2", + "italic": true, + "bold": false, + "underline": false, + "labelWidth": 0, + "labelHeight": 0, + "labelPosition": "", + "labelPercentage": 0, + "route": [ + { + "x": 199.25, + "y": 78 + }, + { + "x": 199.25, + "y": 118 + }, + { + "x": 262.5, + "y": 118 + }, + { + "x": 262.5, + "y": 208 + } + ], + "animated": false, + "tooltip": "", + "icon": null, + "zIndex": 0 + }, + { + "id": "(f <-> g)[0]", + "src": "f", + "srcArrow": "triangle", + "dst": "g", + "dstArrow": "triangle", + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "stroke": "B1", + "borderRadius": 10, + "label": "", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "N2", + "italic": true, + "bold": false, + "underline": false, + "labelWidth": 0, + "labelHeight": 0, + "labelPosition": "", + "labelPercentage": 0, + "route": [ + { + "x": 336, + "y": 78 + }, + { + "x": 336, + "y": 208 + } + ], + "animated": true, + "tooltip": "", + "icon": null, + "zIndex": 0 + }, + { + "id": "(x -- x)[0]", + "src": "x", + "srcArrow": "none", + "dst": "x", + "dstArrow": "none", + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "stroke": "B1", + "borderRadius": 10, + "label": "", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "N2", + "italic": true, + "bold": false, + "underline": false, + "labelWidth": 0, + "labelHeight": 0, + "labelPosition": "", + "labelPercentage": 0, + "route": [ + { + "x": 433, + "y": 34 + }, + { + "x": 383, + "y": 34 + }, + { + "x": 383, + "y": 56 + }, + { + "x": 433, + "y": 56 + } + ], + "animated": true, + "tooltip": "", + "icon": null, + "zIndex": 0 + } + ], + "root": { + "id": "", + "type": "", + "pos": { + "x": 0, + "y": 0 + }, + "width": 0, + "height": 0, + "opacity": 0, + "strokeDash": 0, + "strokeWidth": 0, + "borderRadius": 0, + "fill": "N7", + "stroke": "", + "shadow": false, + "3d": false, + "multiple": false, + "double-border": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "", + "fontSize": 0, + "fontFamily": "", + "language": "", + "color": "", + "italic": false, + "bold": false, + "underline": false, + "labelWidth": 0, + "labelHeight": 0, + "zIndex": 0, + "level": 0 + } +} diff --git a/e2etests/testdata/txtar/sketch-bidirectional-connection-animation/elk/sketch.exp.svg b/e2etests/testdata/txtar/sketch-bidirectional-connection-animation/elk/sketch.exp.svg new file mode 100644 index 000000000..9603d3358 --- /dev/null +++ b/e2etests/testdata/txtar/sketch-bidirectional-connection-animation/elk/sketch.exp.svg @@ -0,0 +1,116 @@ + + + + + + + + +abcdefgx + + + + + + + + + + \ No newline at end of file diff --git a/lib/svg/path.go b/lib/svg/path.go index f3d2d6606..56201c8ce 100644 --- a/lib/svg/path.go +++ b/lib/svg/path.go @@ -200,7 +200,6 @@ func pathLength(pathData []string) (float64, error) { pathLength += geo.EuclideanDistance(prevPosition.X, prevPosition.Y, x, y) default: - fmt.Println("hello", pathData[i]) return 0, fmt.Errorf("unknown svg path command \"%s\"", pathData[i]) } @@ -228,7 +227,6 @@ func SplitPath(path string, percentage float64) (string, string, error) { pastHalf := false pathData := strings.Split(path, " ") pathLen, err := pathLength(pathData) - fmt.Println("pathLen:", pathLen) if err != nil { return "", "", err From 92417196c9dcf9e6463094b611b06f65ffa79308 Mon Sep 17 00:00:00 2001 From: Daniel Suh <23denial@gmail.com> Date: Mon, 20 May 2024 12:58:27 -0400 Subject: [PATCH 3/8] revert changes from testing --- .../TestCLI_E2E/internal_linked_pdf.exp.pdf | Bin 66068 -> 66068 bytes .../testdata/TestCLI_E2E/no-nav-pdf.exp.pdf | Bin 96034 -> 96034 bytes .../testdata/TestCLI_E2E/no-nav-pptx.exp.pptx | Bin 122131 -> 122127 bytes .../TestCLI_E2E/renamed-board.exp.pdf | Bin 109975 -> 109975 bytes .../testdata/TestCLI_E2E/theme-pdf.exp.pdf | Bin 17306 -> 17306 bytes 5 files changed, 0 insertions(+), 0 deletions(-) diff --git a/e2etests-cli/testdata/TestCLI_E2E/internal_linked_pdf.exp.pdf b/e2etests-cli/testdata/TestCLI_E2E/internal_linked_pdf.exp.pdf index 0cdc62313ebfc74ccc5bfd27165fa0be382d4342..7c1a8847dd2ac8f9e0ca68c8b64454c881ad6aa4 100644 GIT binary patch delta 181 zcmbQz!ZM|WWy1%F$^6}m7>zb>>fYuvxgyg5$W`9F`^F=c$@jYqCV!Av#Avd4vgA|$ z$r(35T;S?HhsXOCOiJKW;C2!`_GWkc=Gyxsj4Q1=7yFgmWF1U zT>8HGDK3d6sR|k{Rz?O!CI)c1&6fYonY0ZpOcV@2Kp{_o3(PP!H8-$C6Eih4HaDI= In~|{+0AqbW8~^|S delta 185 zcmbQz!ZM|WWy1%F$?LioF&b?S?0M=x*)z=m$W@*^C#`7n?>mbWCf9WvO#UFTh|y&8 zWXWwllg;jcxXPR7q&-rZJom5jWWj$1lkfdCob33|n$dW2?LR|C!^!LarK*}585kOw z7@8Pqa_Rf#r?@1Rq$+5*SQ!}@nHa$3He3ETXVSK`v{Wzv0fjsTE-=H`)YQ}fP0ZBP M*wS+PY(~aP061zv!~g&Q diff --git a/e2etests-cli/testdata/TestCLI_E2E/no-nav-pdf.exp.pdf b/e2etests-cli/testdata/TestCLI_E2E/no-nav-pdf.exp.pdf index f577774c3e1de114d89311eeb80e01d27d33e8f8..73d6e3754de3b03f34ccfa42dc02e1106a3ad970 100644 GIT binary patch delta 55 zcmZ4Vj&;#H)`l&NN+qf$hUSKrCYFXKnq2z6`6(`mC8-J;E>=bcMkWSux$W*HjJKHp D;CT<( delta 55 zcmZ4Vj&;#H)`l&NN+qhMMh1pPCWgkAnq2z6`6(`mC8-J;E>=bcMkWSux$W*HjJKHp D-OUfb diff --git a/e2etests-cli/testdata/TestCLI_E2E/no-nav-pptx.exp.pptx b/e2etests-cli/testdata/TestCLI_E2E/no-nav-pptx.exp.pptx index 2adb5e28d5956d553b099a2ea147da14e037039a..cf1579ac5ebe9fbd46d2730a5db52a1a9aeeb295 100644 GIT binary patch delta 473 zcmV;~0Ve*Fx(AQC2Y|Ez7RP_hZrd;rgztF@f_I6OVl)k5D?l6M)BpkMqP?=@MrI@a zfLuq?+ZUoMCT@M}aXhmhcSvh{H`#%_LQKZH9c^k(2{`4oas7^d+dotvDM=`umVD+U8taF|$AH;k4nLbU1PKz7(U*&3V! zT#T>g*~FAg36JAgkJmZga^A2Xk6*s#+Ldw3)hVD|9^Gms(BJ@_KjM}ZRm^n!`3n>l zd(|bNB1rVHb4upGs!x9b6~qh7qmMcf_BNy;sb~Tk@4BZ52^`8rkRBXFiJ-}7@IdZc zQjw)o5{&6~kgl(lxA~y=jB?l@6Fz!vo(Hxh|UDfJS!TGZ38RRN2wEeTx|FKufTQMaO zdLQTI(sQ-*FQfY%00960P)i30s#Lz`oB;p;Ww*h|0nZZ&s#Lz`oB;p;WtW-U0Z;+J Pm+IUBBL*PL0RR91`&i$R delta 482 zcmV<80UiF2x(AcG2Y|Ez7RP_jZreN%#P4|uf_I6O;_pL2*b2}FIW<6lx@fN~xsloM zAINoNy?r6NV(d1z9@jJT;|^(U?@rE=S4i0ezoT8tDFLs7Hh$dEultAQ10@-y*U|~ryA>`z&&qBo=Js?KGSXKvcGPfauKRJK<9Fmim+mJ>U zrFxMgu%7e(nFEwsqGSuSiIqw(uv%4YJSJNpS~0NTz++}z+c8?b2+8Gl14UuiWM^=W z@UDFouM($hs(G5GcDgP0p7V}4$9_oN|9vn&|Xy_J4!RdD5?OGZ7+%8ZXen`Z<1<9xZ=-(n3Vcs0vkZs>}wj_bPR zjn2hDlT$Y0{64Gl?e^3C{(%lX?>7zquj%=|>&2!M8{Y7Z;CwFG_X_d{+WlVY-`FeV zt(cMsV@UII^`+YNS2Fwx00960P)i30qNc06paB2?ahIRF0Ufv6$N{nw38JQ}yPyF8 Y0CAU<+yPJl#FysW0V4(^%K-oY0Qd&(fdBvi diff --git a/e2etests-cli/testdata/TestCLI_E2E/renamed-board.exp.pdf b/e2etests-cli/testdata/TestCLI_E2E/renamed-board.exp.pdf index 8628441e39da91d8d9cb4e692eaace5947a46ef7..581e72d2a77bca16b0b2e4c6277e2d32a38184d9 100644 GIT binary patch delta 70 zcmbP!n{E1SwuUW?Nh_yMS;?qBJz*uI(e%SB8854v7@8Yenphf|XmaWM=BKzMmZU0Z UxL6q(7?~Kr<+kr$#dwDa0F-wZZ2$lO delta 70 zcmbP!n{E1SwuUW?Nh_yMUdd=MJz*uI;q=2R8854v8W|WGnHU;dYI5oO=BKzMmZU0Z UxL6q(7?~Kr<+kr$#dwDa0Fjm#QUCw| diff --git a/e2etests-cli/testdata/TestCLI_E2E/theme-pdf.exp.pdf b/e2etests-cli/testdata/TestCLI_E2E/theme-pdf.exp.pdf index ffd681ab13e139e54fb0dfd923bc8e4b3cfd4071..01c7166e15d8e436c7ba1a17db06e0b1c1cb8e93 100644 GIT binary patch delta 52 zcmbQ$&N!=`al Date: Mon, 20 May 2024 13:02:28 -0400 Subject: [PATCH 4/8] delete old bidirectional test --- .../dagre/board.exp.json | 703 ------------------ .../dagre/sketch.exp.svg | 116 --- .../elk/board.exp.json | 653 ---------------- .../elk/sketch.exp.svg | 116 --- 4 files changed, 1588 deletions(-) delete mode 100644 e2etests/testdata/txtar/bidirectional_connection_animation/dagre/board.exp.json delete mode 100644 e2etests/testdata/txtar/bidirectional_connection_animation/dagre/sketch.exp.svg delete mode 100644 e2etests/testdata/txtar/bidirectional_connection_animation/elk/board.exp.json delete mode 100644 e2etests/testdata/txtar/bidirectional_connection_animation/elk/sketch.exp.svg diff --git a/e2etests/testdata/txtar/bidirectional_connection_animation/dagre/board.exp.json b/e2etests/testdata/txtar/bidirectional_connection_animation/dagre/board.exp.json deleted file mode 100644 index 09c09cfbe..000000000 --- a/e2etests/testdata/txtar/bidirectional_connection_animation/dagre/board.exp.json +++ /dev/null @@ -1,703 +0,0 @@ -{ - "name": "", - "config": { - "sketch": true, - "themeID": null, - "darkThemeID": null, - "pad": null, - "center": null, - "layoutEngine": null - }, - "isFolderOnly": false, - "fontFamily": "HandDrawn", - "shapes": [ - { - "id": "a", - "type": "rectangle", - "pos": { - "x": 172, - "y": 0 - }, - "width": 54, - "height": 66, - "opacity": 1, - "strokeDash": 0, - "strokeWidth": 2, - "borderRadius": 0, - "fill": "B6", - "stroke": "B1", - "shadow": false, - "3d": false, - "multiple": false, - "double-border": false, - "tooltip": "", - "link": "", - "icon": null, - "iconPosition": "", - "blend": false, - "fields": null, - "methods": null, - "columns": null, - "label": "a", - "fontSize": 16, - "fontFamily": "DEFAULT", - "language": "", - "color": "N1", - "italic": false, - "bold": true, - "underline": false, - "labelWidth": 9, - "labelHeight": 21, - "labelPosition": "INSIDE_MIDDLE_CENTER", - "zIndex": 0, - "level": 1 - }, - { - "id": "b", - "type": "rectangle", - "pos": { - "x": 0, - "y": 166 - }, - "width": 55, - "height": 66, - "opacity": 1, - "strokeDash": 0, - "strokeWidth": 2, - "borderRadius": 0, - "fill": "B6", - "stroke": "B1", - "shadow": false, - "3d": false, - "multiple": false, - "double-border": false, - "tooltip": "", - "link": "", - "icon": null, - "iconPosition": "", - "blend": false, - "fields": null, - "methods": null, - "columns": null, - "label": "b", - "fontSize": 16, - "fontFamily": "DEFAULT", - "language": "", - "color": "N1", - "italic": false, - "bold": true, - "underline": false, - "labelWidth": 10, - "labelHeight": 21, - "labelPosition": "INSIDE_MIDDLE_CENTER", - "zIndex": 0, - "level": 1 - }, - { - "id": "c", - "type": "rectangle", - "pos": { - "x": 115, - "y": 166 - }, - "width": 54, - "height": 66, - "opacity": 1, - "strokeDash": 0, - "strokeWidth": 2, - "borderRadius": 0, - "fill": "B6", - "stroke": "B1", - "shadow": false, - "3d": false, - "multiple": false, - "double-border": false, - "tooltip": "", - "link": "", - "icon": null, - "iconPosition": "", - "blend": false, - "fields": null, - "methods": null, - "columns": null, - "label": "c", - "fontSize": 16, - "fontFamily": "DEFAULT", - "language": "", - "color": "N1", - "italic": false, - "bold": true, - "underline": false, - "labelWidth": 9, - "labelHeight": 21, - "labelPosition": "INSIDE_MIDDLE_CENTER", - "zIndex": 0, - "level": 1 - }, - { - "id": "d", - "type": "rectangle", - "pos": { - "x": 229, - "y": 166 - }, - "width": 55, - "height": 66, - "opacity": 1, - "strokeDash": 0, - "strokeWidth": 2, - "borderRadius": 0, - "fill": "B6", - "stroke": "B1", - "shadow": false, - "3d": false, - "multiple": false, - "double-border": false, - "tooltip": "", - "link": "", - "icon": null, - "iconPosition": "", - "blend": false, - "fields": null, - "methods": null, - "columns": null, - "label": "d", - "fontSize": 16, - "fontFamily": "DEFAULT", - "language": "", - "color": "N1", - "italic": false, - "bold": true, - "underline": false, - "labelWidth": 10, - "labelHeight": 21, - "labelPosition": "INSIDE_MIDDLE_CENTER", - "zIndex": 0, - "level": 1 - }, - { - "id": "e", - "type": "rectangle", - "pos": { - "x": 344, - "y": 166 - }, - "width": 53, - "height": 66, - "opacity": 1, - "strokeDash": 0, - "strokeWidth": 2, - "borderRadius": 0, - "fill": "B6", - "stroke": "B1", - "shadow": false, - "3d": false, - "multiple": false, - "double-border": false, - "tooltip": "", - "link": "", - "icon": null, - "iconPosition": "", - "blend": false, - "fields": null, - "methods": null, - "columns": null, - "label": "e", - "fontSize": 16, - "fontFamily": "DEFAULT", - "language": "", - "color": "N1", - "italic": false, - "bold": true, - "underline": false, - "labelWidth": 8, - "labelHeight": 21, - "labelPosition": "INSIDE_MIDDLE_CENTER", - "zIndex": 0, - "level": 1 - }, - { - "id": "f", - "type": "rectangle", - "pos": { - "x": 457, - "y": 0 - }, - "width": 54, - "height": 66, - "opacity": 1, - "strokeDash": 0, - "strokeWidth": 2, - "borderRadius": 0, - "fill": "B6", - "stroke": "B1", - "shadow": false, - "3d": false, - "multiple": false, - "double-border": false, - "tooltip": "", - "link": "", - "icon": null, - "iconPosition": "", - "blend": false, - "fields": null, - "methods": null, - "columns": null, - "label": "f", - "fontSize": 16, - "fontFamily": "DEFAULT", - "language": "", - "color": "N1", - "italic": false, - "bold": true, - "underline": false, - "labelWidth": 9, - "labelHeight": 21, - "labelPosition": "INSIDE_MIDDLE_CENTER", - "zIndex": 0, - "level": 1 - }, - { - "id": "g", - "type": "rectangle", - "pos": { - "x": 457, - "y": 166 - }, - "width": 54, - "height": 66, - "opacity": 1, - "strokeDash": 0, - "strokeWidth": 2, - "borderRadius": 0, - "fill": "B6", - "stroke": "B1", - "shadow": false, - "3d": false, - "multiple": false, - "double-border": false, - "tooltip": "", - "link": "", - "icon": null, - "iconPosition": "", - "blend": false, - "fields": null, - "methods": null, - "columns": null, - "label": "g", - "fontSize": 16, - "fontFamily": "DEFAULT", - "language": "", - "color": "N1", - "italic": false, - "bold": true, - "underline": false, - "labelWidth": 9, - "labelHeight": 21, - "labelPosition": "INSIDE_MIDDLE_CENTER", - "zIndex": 0, - "level": 1 - }, - { - "id": "x", - "type": "rectangle", - "pos": { - "x": 571, - "y": 0 - }, - "width": 54, - "height": 66, - "opacity": 1, - "strokeDash": 0, - "strokeWidth": 2, - "borderRadius": 0, - "fill": "B6", - "stroke": "B1", - "shadow": false, - "3d": false, - "multiple": false, - "double-border": false, - "tooltip": "", - "link": "", - "icon": null, - "iconPosition": "", - "blend": false, - "fields": null, - "methods": null, - "columns": null, - "label": "x", - "fontSize": 16, - "fontFamily": "DEFAULT", - "language": "", - "color": "N1", - "italic": false, - "bold": true, - "underline": false, - "labelWidth": 9, - "labelHeight": 21, - "labelPosition": "INSIDE_MIDDLE_CENTER", - "zIndex": 0, - "level": 1 - } - ], - "connections": [ - { - "id": "(a <-> b)[0]", - "src": "a", - "srcArrow": "triangle", - "dst": "b", - "dstArrow": "triangle", - "opacity": 1, - "strokeDash": 0, - "strokeWidth": 2, - "stroke": "B1", - "borderRadius": 10, - "label": "", - "fontSize": 16, - "fontFamily": "DEFAULT", - "language": "", - "color": "N2", - "italic": true, - "bold": false, - "underline": false, - "labelWidth": 0, - "labelHeight": 0, - "labelPosition": "", - "labelPercentage": 0, - "route": [ - { - "x": 172.5, - "y": 46 - }, - { - "x": 56.5, - "y": 102 - }, - { - "x": 27.5, - "y": 126 - }, - { - "x": 27.5, - "y": 166 - } - ], - "isCurve": true, - "animated": true, - "tooltip": "", - "icon": null, - "zIndex": 0 - }, - { - "id": "(a <-> c)[0]", - "src": "a", - "srcArrow": "triangle", - "dst": "c", - "dstArrow": "triangle", - "opacity": 1, - "strokeDash": 0, - "strokeWidth": 2, - "stroke": "B1", - "borderRadius": 10, - "label": "", - "fontSize": 16, - "fontFamily": "DEFAULT", - "language": "", - "color": "N2", - "italic": true, - "bold": false, - "underline": false, - "labelWidth": 0, - "labelHeight": 0, - "labelPosition": "", - "labelPercentage": 0, - "route": [ - { - "x": 176, - "y": 66 - }, - { - "x": 148.8000030517578, - "y": 106 - }, - { - "x": 142, - "y": 126 - }, - { - "x": 142, - "y": 166 - } - ], - "isCurve": true, - "animated": true, - "tooltip": "", - "icon": null, - "zIndex": 0 - }, - { - "id": "(a <-> d)[0]", - "src": "a", - "srcArrow": "triangle", - "dst": "d", - "dstArrow": "triangle", - "opacity": 1, - "strokeDash": 0, - "strokeWidth": 2, - "stroke": "B1", - "borderRadius": 10, - "label": "", - "fontSize": 16, - "fontFamily": "DEFAULT", - "language": "", - "color": "N2", - "italic": true, - "bold": false, - "underline": false, - "labelWidth": 0, - "labelHeight": 0, - "labelPosition": "", - "labelPercentage": 0, - "route": [ - { - "x": 222.5, - "y": 66 - }, - { - "x": 249.6999969482422, - "y": 106 - }, - { - "x": 256.5, - "y": 126 - }, - { - "x": 256.5, - "y": 166 - } - ], - "isCurve": true, - "animated": true, - "tooltip": "", - "icon": null, - "zIndex": 0 - }, - { - "id": "(a <-> e)[0]", - "src": "a", - "srcArrow": "triangle", - "dst": "e", - "dstArrow": "triangle", - "opacity": 1, - "strokeDash": 0, - "strokeWidth": 2, - "stroke": "B1", - "borderRadius": 10, - "label": "", - "fontSize": 16, - "fontFamily": "DEFAULT", - "language": "", - "color": "N2", - "italic": true, - "bold": false, - "underline": false, - "labelWidth": 0, - "labelHeight": 0, - "labelPosition": "", - "labelPercentage": 0, - "route": [ - { - "x": 226.25, - "y": 46.08599853515625 - }, - { - "x": 341.6499938964844, - "y": 102.01699829101562 - }, - { - "x": 370.5, - "y": 126 - }, - { - "x": 370.5, - "y": 166 - } - ], - "isCurve": true, - "animated": true, - "tooltip": "", - "icon": null, - "zIndex": 0 - }, - { - "id": "(f <-> g)[0]", - "src": "f", - "srcArrow": "triangle", - "dst": "g", - "dstArrow": "triangle", - "opacity": 1, - "strokeDash": 0, - "strokeWidth": 2, - "stroke": "B1", - "borderRadius": 10, - "label": "", - "fontSize": 16, - "fontFamily": "DEFAULT", - "language": "", - "color": "N2", - "italic": true, - "bold": false, - "underline": false, - "labelWidth": 0, - "labelHeight": 0, - "labelPosition": "", - "labelPercentage": 0, - "route": [ - { - "x": 484, - "y": 66 - }, - { - "x": 484, - "y": 106 - }, - { - "x": 484, - "y": 126 - }, - { - "x": 484, - "y": 166 - } - ], - "isCurve": true, - "animated": true, - "tooltip": "", - "icon": null, - "zIndex": 0 - }, - { - "id": "(x -- x)[0]", - "src": "x", - "srcArrow": "none", - "dst": "x", - "dstArrow": "none", - "opacity": 1, - "strokeDash": 0, - "strokeWidth": 2, - "stroke": "B1", - "borderRadius": 10, - "label": "", - "fontSize": 16, - "fontFamily": "DEFAULT", - "language": "", - "color": "N2", - "italic": true, - "bold": false, - "underline": false, - "labelWidth": 0, - "labelHeight": 0, - "labelPosition": "", - "labelPercentage": 0, - "route": [ - { - "x": 624.666015625, - "y": 16 - }, - { - "x": 646.2659912109375, - "y": 3.1989998817443848 - }, - { - "x": 653, - "y": 0 - }, - { - "x": 655, - "y": 0 - }, - { - "x": 657, - "y": 0 - }, - { - "x": 659.666015625, - "y": 6.599999904632568 - }, - { - "x": 661.666015625, - "y": 16.5 - }, - { - "x": 663.666015625, - "y": 26.399999618530273 - }, - { - "x": 663.666015625, - "y": 39.599998474121094 - }, - { - "x": 661.666015625, - "y": 49.5 - }, - { - "x": 659.666015625, - "y": 59.400001525878906 - }, - { - "x": 646.2659912109375, - "y": 62.79999923706055 - }, - { - "x": 624.666015625, - "y": 50 - } - ], - "isCurve": true, - "animated": true, - "tooltip": "", - "icon": null, - "zIndex": 0 - } - ], - "root": { - "id": "", - "type": "", - "pos": { - "x": 0, - "y": 0 - }, - "width": 0, - "height": 0, - "opacity": 0, - "strokeDash": 0, - "strokeWidth": 0, - "borderRadius": 0, - "fill": "N7", - "stroke": "", - "shadow": false, - "3d": false, - "multiple": false, - "double-border": false, - "tooltip": "", - "link": "", - "icon": null, - "iconPosition": "", - "blend": false, - "fields": null, - "methods": null, - "columns": null, - "label": "", - "fontSize": 0, - "fontFamily": "", - "language": "", - "color": "", - "italic": false, - "bold": false, - "underline": false, - "labelWidth": 0, - "labelHeight": 0, - "zIndex": 0, - "level": 0 - } -} diff --git a/e2etests/testdata/txtar/bidirectional_connection_animation/dagre/sketch.exp.svg b/e2etests/testdata/txtar/bidirectional_connection_animation/dagre/sketch.exp.svg deleted file mode 100644 index 8feb1399c..000000000 --- a/e2etests/testdata/txtar/bidirectional_connection_animation/dagre/sketch.exp.svg +++ /dev/null @@ -1,116 +0,0 @@ - - - - - - - - -abcdefgx - - - - - - - - - - \ No newline at end of file diff --git a/e2etests/testdata/txtar/bidirectional_connection_animation/elk/board.exp.json b/e2etests/testdata/txtar/bidirectional_connection_animation/elk/board.exp.json deleted file mode 100644 index 9eadf807d..000000000 --- a/e2etests/testdata/txtar/bidirectional_connection_animation/elk/board.exp.json +++ /dev/null @@ -1,653 +0,0 @@ -{ - "name": "", - "config": { - "sketch": true, - "themeID": null, - "darkThemeID": null, - "pad": null, - "center": null, - "layoutEngine": null - }, - "isFolderOnly": false, - "fontFamily": "HandDrawn", - "shapes": [ - { - "id": "a", - "type": "rectangle", - "pos": { - "x": 71, - "y": 12 - }, - "width": 160, - "height": 66, - "opacity": 1, - "strokeDash": 0, - "strokeWidth": 2, - "borderRadius": 0, - "fill": "B6", - "stroke": "B1", - "shadow": false, - "3d": false, - "multiple": false, - "double-border": false, - "tooltip": "", - "link": "", - "icon": null, - "iconPosition": "", - "blend": false, - "fields": null, - "methods": null, - "columns": null, - "label": "a", - "fontSize": 16, - "fontFamily": "DEFAULT", - "language": "", - "color": "N1", - "italic": false, - "bold": true, - "underline": false, - "labelWidth": 9, - "labelHeight": 21, - "labelPosition": "INSIDE_MIDDLE_CENTER", - "zIndex": 0, - "level": 1 - }, - { - "id": "b", - "type": "rectangle", - "pos": { - "x": 12, - "y": 208 - }, - "width": 55, - "height": 66, - "opacity": 1, - "strokeDash": 0, - "strokeWidth": 2, - "borderRadius": 0, - "fill": "B6", - "stroke": "B1", - "shadow": false, - "3d": false, - "multiple": false, - "double-border": false, - "tooltip": "", - "link": "", - "icon": null, - "iconPosition": "", - "blend": false, - "fields": null, - "methods": null, - "columns": null, - "label": "b", - "fontSize": 16, - "fontFamily": "DEFAULT", - "language": "", - "color": "N1", - "italic": false, - "bold": true, - "underline": false, - "labelWidth": 10, - "labelHeight": 21, - "labelPosition": "INSIDE_MIDDLE_CENTER", - "zIndex": 0, - "level": 1 - }, - { - "id": "c", - "type": "rectangle", - "pos": { - "x": 87, - "y": 208 - }, - "width": 54, - "height": 66, - "opacity": 1, - "strokeDash": 0, - "strokeWidth": 2, - "borderRadius": 0, - "fill": "B6", - "stroke": "B1", - "shadow": false, - "3d": false, - "multiple": false, - "double-border": false, - "tooltip": "", - "link": "", - "icon": null, - "iconPosition": "", - "blend": false, - "fields": null, - "methods": null, - "columns": null, - "label": "c", - "fontSize": 16, - "fontFamily": "DEFAULT", - "language": "", - "color": "N1", - "italic": false, - "bold": true, - "underline": false, - "labelWidth": 9, - "labelHeight": 21, - "labelPosition": "INSIDE_MIDDLE_CENTER", - "zIndex": 0, - "level": 1 - }, - { - "id": "d", - "type": "rectangle", - "pos": { - "x": 161, - "y": 208 - }, - "width": 55, - "height": 66, - "opacity": 1, - "strokeDash": 0, - "strokeWidth": 2, - "borderRadius": 0, - "fill": "B6", - "stroke": "B1", - "shadow": false, - "3d": false, - "multiple": false, - "double-border": false, - "tooltip": "", - "link": "", - "icon": null, - "iconPosition": "", - "blend": false, - "fields": null, - "methods": null, - "columns": null, - "label": "d", - "fontSize": 16, - "fontFamily": "DEFAULT", - "language": "", - "color": "N1", - "italic": false, - "bold": true, - "underline": false, - "labelWidth": 10, - "labelHeight": 21, - "labelPosition": "INSIDE_MIDDLE_CENTER", - "zIndex": 0, - "level": 1 - }, - { - "id": "e", - "type": "rectangle", - "pos": { - "x": 236, - "y": 208 - }, - "width": 53, - "height": 66, - "opacity": 1, - "strokeDash": 0, - "strokeWidth": 2, - "borderRadius": 0, - "fill": "B6", - "stroke": "B1", - "shadow": false, - "3d": false, - "multiple": false, - "double-border": false, - "tooltip": "", - "link": "", - "icon": null, - "iconPosition": "", - "blend": false, - "fields": null, - "methods": null, - "columns": null, - "label": "e", - "fontSize": 16, - "fontFamily": "DEFAULT", - "language": "", - "color": "N1", - "italic": false, - "bold": true, - "underline": false, - "labelWidth": 8, - "labelHeight": 21, - "labelPosition": "INSIDE_MIDDLE_CENTER", - "zIndex": 0, - "level": 1 - }, - { - "id": "f", - "type": "rectangle", - "pos": { - "x": 309, - "y": 12 - }, - "width": 54, - "height": 66, - "opacity": 1, - "strokeDash": 0, - "strokeWidth": 2, - "borderRadius": 0, - "fill": "B6", - "stroke": "B1", - "shadow": false, - "3d": false, - "multiple": false, - "double-border": false, - "tooltip": "", - "link": "", - "icon": null, - "iconPosition": "", - "blend": false, - "fields": null, - "methods": null, - "columns": null, - "label": "f", - "fontSize": 16, - "fontFamily": "DEFAULT", - "language": "", - "color": "N1", - "italic": false, - "bold": true, - "underline": false, - "labelWidth": 9, - "labelHeight": 21, - "labelPosition": "INSIDE_MIDDLE_CENTER", - "zIndex": 0, - "level": 1 - }, - { - "id": "g", - "type": "rectangle", - "pos": { - "x": 309, - "y": 208 - }, - "width": 54, - "height": 66, - "opacity": 1, - "strokeDash": 0, - "strokeWidth": 2, - "borderRadius": 0, - "fill": "B6", - "stroke": "B1", - "shadow": false, - "3d": false, - "multiple": false, - "double-border": false, - "tooltip": "", - "link": "", - "icon": null, - "iconPosition": "", - "blend": false, - "fields": null, - "methods": null, - "columns": null, - "label": "g", - "fontSize": 16, - "fontFamily": "DEFAULT", - "language": "", - "color": "N1", - "italic": false, - "bold": true, - "underline": false, - "labelWidth": 9, - "labelHeight": 21, - "labelPosition": "INSIDE_MIDDLE_CENTER", - "zIndex": 0, - "level": 1 - }, - { - "id": "x", - "type": "rectangle", - "pos": { - "x": 433, - "y": 12 - }, - "width": 54, - "height": 66, - "opacity": 1, - "strokeDash": 0, - "strokeWidth": 2, - "borderRadius": 0, - "fill": "B6", - "stroke": "B1", - "shadow": false, - "3d": false, - "multiple": false, - "double-border": false, - "tooltip": "", - "link": "", - "icon": null, - "iconPosition": "", - "blend": false, - "fields": null, - "methods": null, - "columns": null, - "label": "x", - "fontSize": 16, - "fontFamily": "DEFAULT", - "language": "", - "color": "N1", - "italic": false, - "bold": true, - "underline": false, - "labelWidth": 9, - "labelHeight": 21, - "labelPosition": "INSIDE_MIDDLE_CENTER", - "zIndex": 0, - "level": 1 - } - ], - "connections": [ - { - "id": "(a <-> b)[0]", - "src": "a", - "srcArrow": "triangle", - "dst": "b", - "dstArrow": "triangle", - "opacity": 1, - "strokeDash": 0, - "strokeWidth": 2, - "stroke": "B1", - "borderRadius": 10, - "label": "", - "fontSize": 16, - "fontFamily": "DEFAULT", - "language": "", - "color": "N2", - "italic": true, - "bold": false, - "underline": false, - "labelWidth": 0, - "labelHeight": 0, - "labelPosition": "", - "labelPercentage": 0, - "route": [ - { - "x": 103.25, - "y": 78 - }, - { - "x": 103.25, - "y": 118 - }, - { - "x": 39.5, - "y": 118 - }, - { - "x": 39.5, - "y": 208 - } - ], - "animated": true, - "tooltip": "", - "icon": null, - "zIndex": 0 - }, - { - "id": "(a <-> c)[0]", - "src": "a", - "srcArrow": "triangle", - "dst": "c", - "dstArrow": "triangle", - "opacity": 1, - "strokeDash": 0, - "strokeWidth": 2, - "stroke": "B1", - "borderRadius": 10, - "label": "", - "fontSize": 16, - "fontFamily": "DEFAULT", - "language": "", - "color": "N2", - "italic": true, - "bold": false, - "underline": false, - "labelWidth": 0, - "labelHeight": 0, - "labelPosition": "", - "labelPercentage": 0, - "route": [ - { - "x": 135.25, - "y": 78 - }, - { - "x": 135.25, - "y": 168 - }, - { - "x": 114, - "y": 168 - }, - { - "x": 114, - "y": 208 - } - ], - "animated": true, - "tooltip": "", - "icon": null, - "zIndex": 0 - }, - { - "id": "(a <-> d)[0]", - "src": "a", - "srcArrow": "triangle", - "dst": "d", - "dstArrow": "triangle", - "opacity": 1, - "strokeDash": 0, - "strokeWidth": 2, - "stroke": "B1", - "borderRadius": 10, - "label": "", - "fontSize": 16, - "fontFamily": "DEFAULT", - "language": "", - "color": "N2", - "italic": true, - "bold": false, - "underline": false, - "labelWidth": 0, - "labelHeight": 0, - "labelPosition": "", - "labelPercentage": 0, - "route": [ - { - "x": 167.25, - "y": 78 - }, - { - "x": 167.25, - "y": 168 - }, - { - "x": 188.5, - "y": 168 - }, - { - "x": 188.5, - "y": 208 - } - ], - "animated": true, - "tooltip": "", - "icon": null, - "zIndex": 0 - }, - { - "id": "(a <-> e)[0]", - "src": "a", - "srcArrow": "triangle", - "dst": "e", - "dstArrow": "triangle", - "opacity": 1, - "strokeDash": 0, - "strokeWidth": 2, - "stroke": "B1", - "borderRadius": 10, - "label": "", - "fontSize": 16, - "fontFamily": "DEFAULT", - "language": "", - "color": "N2", - "italic": true, - "bold": false, - "underline": false, - "labelWidth": 0, - "labelHeight": 0, - "labelPosition": "", - "labelPercentage": 0, - "route": [ - { - "x": 199.25, - "y": 78 - }, - { - "x": 199.25, - "y": 118 - }, - { - "x": 262.5, - "y": 118 - }, - { - "x": 262.5, - "y": 208 - } - ], - "animated": true, - "tooltip": "", - "icon": null, - "zIndex": 0 - }, - { - "id": "(f <-> g)[0]", - "src": "f", - "srcArrow": "triangle", - "dst": "g", - "dstArrow": "triangle", - "opacity": 1, - "strokeDash": 0, - "strokeWidth": 2, - "stroke": "B1", - "borderRadius": 10, - "label": "", - "fontSize": 16, - "fontFamily": "DEFAULT", - "language": "", - "color": "N2", - "italic": true, - "bold": false, - "underline": false, - "labelWidth": 0, - "labelHeight": 0, - "labelPosition": "", - "labelPercentage": 0, - "route": [ - { - "x": 336, - "y": 78 - }, - { - "x": 336, - "y": 208 - } - ], - "animated": true, - "tooltip": "", - "icon": null, - "zIndex": 0 - }, - { - "id": "(x -- x)[0]", - "src": "x", - "srcArrow": "none", - "dst": "x", - "dstArrow": "none", - "opacity": 1, - "strokeDash": 0, - "strokeWidth": 2, - "stroke": "B1", - "borderRadius": 10, - "label": "", - "fontSize": 16, - "fontFamily": "DEFAULT", - "language": "", - "color": "N2", - "italic": true, - "bold": false, - "underline": false, - "labelWidth": 0, - "labelHeight": 0, - "labelPosition": "", - "labelPercentage": 0, - "route": [ - { - "x": 433, - "y": 34 - }, - { - "x": 383, - "y": 34 - }, - { - "x": 383, - "y": 56 - }, - { - "x": 433, - "y": 56 - } - ], - "animated": true, - "tooltip": "", - "icon": null, - "zIndex": 0 - } - ], - "root": { - "id": "", - "type": "", - "pos": { - "x": 0, - "y": 0 - }, - "width": 0, - "height": 0, - "opacity": 0, - "strokeDash": 0, - "strokeWidth": 0, - "borderRadius": 0, - "fill": "N7", - "stroke": "", - "shadow": false, - "3d": false, - "multiple": false, - "double-border": false, - "tooltip": "", - "link": "", - "icon": null, - "iconPosition": "", - "blend": false, - "fields": null, - "methods": null, - "columns": null, - "label": "", - "fontSize": 0, - "fontFamily": "", - "language": "", - "color": "", - "italic": false, - "bold": false, - "underline": false, - "labelWidth": 0, - "labelHeight": 0, - "zIndex": 0, - "level": 0 - } -} diff --git a/e2etests/testdata/txtar/bidirectional_connection_animation/elk/sketch.exp.svg b/e2etests/testdata/txtar/bidirectional_connection_animation/elk/sketch.exp.svg deleted file mode 100644 index 85a25830d..000000000 --- a/e2etests/testdata/txtar/bidirectional_connection_animation/elk/sketch.exp.svg +++ /dev/null @@ -1,116 +0,0 @@ - - - - - - - - -abcdefgx - - - - - - - - - - \ No newline at end of file From 4f996e90aa9546e2f84a7979db412ee207db3990 Mon Sep 17 00:00:00 2001 From: Daniel Suh <23denial@gmail.com> Date: Mon, 20 May 2024 13:07:18 -0400 Subject: [PATCH 5/8] update next.md --- ci/release/changelogs/next.md | 1 + 1 file changed, 1 insertion(+) diff --git a/ci/release/changelogs/next.md b/ci/release/changelogs/next.md index 2728467b1..2a14269f7 100644 --- a/ci/release/changelogs/next.md +++ b/ci/release/changelogs/next.md @@ -4,6 +4,7 @@ - Opacity 0 shapes no longer have a label mask which made any segment of connections going through them lower opacity [#1940](https://github.com/terrastruct/d2/pull/1940) - Bidirectional connections are now animated in opposite directions rather than one direction [#1939](https://github.com/terrastruct/d2/pull/1939) +- Animated connections in sketch mode are now generated in normal mode to fix imperfections in the path #### Bugfixes ⛑️ From b20fa51d4d463913db0a445568c075b7f1768990 Mon Sep 17 00:00:00 2001 From: Daniel Suh <23denial@gmail.com> Date: Mon, 20 May 2024 13:08:24 -0400 Subject: [PATCH 6/8] 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 2a14269f7..e69beabcc 100644 --- a/ci/release/changelogs/next.md +++ b/ci/release/changelogs/next.md @@ -4,7 +4,7 @@ - Opacity 0 shapes no longer have a label mask which made any segment of connections going through them lower opacity [#1940](https://github.com/terrastruct/d2/pull/1940) - Bidirectional connections are now animated in opposite directions rather than one direction [#1939](https://github.com/terrastruct/d2/pull/1939) -- Animated connections in sketch mode are now generated in normal mode to fix imperfections in the path +- Animated connections in sketch mode are now generated in normal mode to fix imperfections in the path [#1944](https://github.com/terrastruct/d2/pull/1944) #### Bugfixes ⛑️ From 2a11e71dc95af3f5433cb215d206aa5707045134 Mon Sep 17 00:00:00 2001 From: Daniel Suh <23denial@gmail.com> Date: Mon, 20 May 2024 14:42:41 -0400 Subject: [PATCH 7/8] fixed comment --- d2renderers/d2sketch/sketch.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/d2renderers/d2sketch/sketch.go b/d2renderers/d2sketch/sketch.go index ea768d948..edb8f547c 100644 --- a/d2renderers/d2sketch/sketch.go +++ b/d2renderers/d2sketch/sketch.go @@ -326,8 +326,8 @@ func Connection(r *Runner, connection d2target.Connection, path, attrs string) ( animatedClass = " animated-connection" } - // If connection is animated and bidirectional if connection.Animated { + // If connection is animated and bidirectional if (connection.DstArrow == d2target.NoArrowhead && connection.SrcArrow == d2target.NoArrowhead) || (connection.DstArrow != d2target.NoArrowhead && connection.SrcArrow != d2target.NoArrowhead) { // There is no pure CSS way to animate bidirectional connections in two directions, so we split it up path1, path2, err := svg.SplitPath(path, 0.5) From 470bfaf25066028e72e05a56892f293380576f93 Mon Sep 17 00:00:00 2001 From: Daniel Suh <23denial@gmail.com> Date: Thu, 23 May 2024 15:47:50 -0400 Subject: [PATCH 8/8] removed change from next.md --- ci/release/changelogs/next.md | 1 - 1 file changed, 1 deletion(-) diff --git a/ci/release/changelogs/next.md b/ci/release/changelogs/next.md index e69beabcc..2728467b1 100644 --- a/ci/release/changelogs/next.md +++ b/ci/release/changelogs/next.md @@ -4,7 +4,6 @@ - Opacity 0 shapes no longer have a label mask which made any segment of connections going through them lower opacity [#1940](https://github.com/terrastruct/d2/pull/1940) - Bidirectional connections are now animated in opposite directions rather than one direction [#1939](https://github.com/terrastruct/d2/pull/1939) -- Animated connections in sketch mode are now generated in normal mode to fix imperfections in the path [#1944](https://github.com/terrastruct/d2/pull/1944) #### Bugfixes ⛑️