diff --git a/e2etests/stable_test.go b/e2etests/stable_test.go index 4e4da7075..c2d3a50f6 100644 --- a/e2etests/stable_test.go +++ b/e2etests/stable_test.go @@ -2785,6 +2785,7 @@ scenarios: { loadFromFile(t, "centered_horizontal_connections"), loadFromFile(t, "all_shapes_link"), loadFromFile(t, "nested_shape_labels"), + loadFromFile(t, "overlapping_child_label"), loadFromFile(t, "dagre_spacing"), loadFromFile(t, "dagre_spacing_right"), } diff --git a/e2etests/testdata/files/overlapping_child_label.d2 b/e2etests/testdata/files/overlapping_child_label.d2 new file mode 100644 index 000000000..8af560505 --- /dev/null +++ b/e2etests/testdata/files/overlapping_child_label.d2 @@ -0,0 +1,33 @@ +heyy: { + label.near: bottom-right + yo -> hey + hey.label.near: outside-bottom-right +} + +ayyy: { + label.near: top-right + icon.near: top-left + class: icon + + beee: { + label.near: outside-top-left + icon.near: outside-top-right + class: icon + } +} + +ceee: { + label.near: top-right + icon.near: bottom-left + class: icon + + deee: { + label.near: outside-top-right + icon.near: outside-bottom-left + class: icon + } +} + +classes: { + icon.icon: https://icons.terrastruct.com/essentials/time.svg +} diff --git a/e2etests/testdata/stable/overlapping_child_label/dagre/board.exp.json b/e2etests/testdata/stable/overlapping_child_label/dagre/board.exp.json new file mode 100644 index 000000000..533dfa432 --- /dev/null +++ b/e2etests/testdata/stable/overlapping_child_label/dagre/board.exp.json @@ -0,0 +1,443 @@ +{ + "name": "", + "isFolderOnly": false, + "fontFamily": "SourceSansPro", + "shapes": [ + { + "id": "heyy", + "type": "rectangle", + "pos": { + "x": 10, + "y": 33 + }, + "width": 131, + "height": 395, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "B4", + "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": "heyy", + "fontSize": 28, + "fontFamily": "DEFAULT", + "language": "", + "color": "N1", + "italic": false, + "bold": false, + "underline": false, + "labelWidth": 54, + "labelHeight": 36, + "labelPosition": "INSIDE_BOTTOM_RIGHT", + "zIndex": 0, + "level": 1 + }, + { + "id": "heyy.yo", + "type": "rectangle", + "pos": { + "x": 44, + "y": 63 + }, + "width": 63, + "height": 66, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "B5", + "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": "yo", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "N1", + "italic": false, + "bold": true, + "underline": false, + "labelWidth": 18, + "labelHeight": 21, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 0, + "level": 2 + }, + { + "id": "heyy.hey", + "type": "rectangle", + "pos": { + "x": 40, + "y": 316 + }, + "width": 71, + "height": 66, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "B5", + "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": "hey", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "N1", + "italic": false, + "bold": true, + "underline": false, + "labelWidth": 26, + "labelHeight": 21, + "labelPosition": "OUTSIDE_BOTTOM_RIGHT", + "zIndex": 0, + "level": 2 + }, + { + "id": "ayyy", + "type": "rectangle", + "classes": [ + "icon" + ], + "pos": { + "x": 181, + "y": -24 + }, + "width": 164, + "height": 196, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "B4", + "stroke": "B1", + "shadow": false, + "3d": false, + "multiple": false, + "double-border": false, + "tooltip": "", + "link": "", + "icon": { + "Scheme": "https", + "Opaque": "", + "User": null, + "Host": "icons.terrastruct.com", + "Path": "/essentials/time.svg", + "RawPath": "", + "OmitHost": false, + "ForceQuery": false, + "RawQuery": "", + "Fragment": "", + "RawFragment": "" + }, + "iconPosition": "INSIDE_TOP_LEFT", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "ayyy", + "fontSize": 28, + "fontFamily": "DEFAULT", + "language": "", + "color": "N1", + "italic": false, + "bold": false, + "underline": false, + "labelWidth": 53, + "labelHeight": 36, + "labelPosition": "INSIDE_TOP_RIGHT", + "zIndex": 0, + "level": 1 + }, + { + "id": "ayyy.beee", + "type": "rectangle", + "classes": [ + "icon" + ], + "pos": { + "x": 211, + "y": 50 + }, + "width": 104, + "height": 92, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "B5", + "stroke": "B1", + "shadow": false, + "3d": false, + "multiple": false, + "double-border": false, + "tooltip": "", + "link": "", + "icon": { + "Scheme": "https", + "Opaque": "", + "User": null, + "Host": "icons.terrastruct.com", + "Path": "/essentials/time.svg", + "RawPath": "", + "OmitHost": false, + "ForceQuery": false, + "RawQuery": "", + "Fragment": "", + "RawFragment": "" + }, + "iconPosition": "OUTSIDE_TOP_RIGHT", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "beee", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "N1", + "italic": false, + "bold": true, + "underline": false, + "labelWidth": 33, + "labelHeight": 21, + "labelPosition": "OUTSIDE_TOP_LEFT", + "zIndex": 0, + "level": 2 + }, + { + "id": "ceee", + "type": "rectangle", + "classes": [ + "icon" + ], + "pos": { + "x": 385, + "y": 4 + }, + "width": 165, + "height": 212, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "B4", + "stroke": "B1", + "shadow": false, + "3d": false, + "multiple": false, + "double-border": false, + "tooltip": "", + "link": "", + "icon": { + "Scheme": "https", + "Opaque": "", + "User": null, + "Host": "icons.terrastruct.com", + "Path": "/essentials/time.svg", + "RawPath": "", + "OmitHost": false, + "ForceQuery": false, + "RawQuery": "", + "Fragment": "", + "RawFragment": "" + }, + "iconPosition": "INSIDE_BOTTOM_LEFT", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "ceee", + "fontSize": 28, + "fontFamily": "DEFAULT", + "language": "", + "color": "N1", + "italic": false, + "bold": false, + "underline": false, + "labelWidth": 53, + "labelHeight": 36, + "labelPosition": "INSIDE_TOP_RIGHT", + "zIndex": 0, + "level": 1 + }, + { + "id": "ceee.deee", + "type": "rectangle", + "classes": [ + "icon" + ], + "pos": { + "x": 415, + "y": 50 + }, + "width": 105, + "height": 92, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "B5", + "stroke": "B1", + "shadow": false, + "3d": false, + "multiple": false, + "double-border": false, + "tooltip": "", + "link": "", + "icon": { + "Scheme": "https", + "Opaque": "", + "User": null, + "Host": "icons.terrastruct.com", + "Path": "/essentials/time.svg", + "RawPath": "", + "OmitHost": false, + "ForceQuery": false, + "RawQuery": "", + "Fragment": "", + "RawFragment": "" + }, + "iconPosition": "OUTSIDE_BOTTOM_LEFT", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "deee", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "N1", + "italic": false, + "bold": true, + "underline": false, + "labelWidth": 34, + "labelHeight": 21, + "labelPosition": "OUTSIDE_TOP_RIGHT", + "zIndex": 0, + "level": 2 + } + ], + "connections": [ + { + "id": "heyy.(yo -> hey)[0]", + "src": "heyy.yo", + "srcArrow": "none", + "dst": "heyy.hey", + "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": 75.5, + "y": 129 + }, + { + "x": 75.5, + "y": 198.60000610351562 + }, + { + "x": 75.5, + "y": 276 + }, + { + "x": 75.5, + "y": 316 + } + ], + "isCurve": true, + "animated": false, + "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/stable/overlapping_child_label/dagre/sketch.exp.svg b/e2etests/testdata/stable/overlapping_child_label/dagre/sketch.exp.svg new file mode 100644 index 000000000..466525352 --- /dev/null +++ b/e2etests/testdata/stable/overlapping_child_label/dagre/sketch.exp.svg @@ -0,0 +1,108 @@ +heyyayyyceeeyoheybeeedeee + + + + + + + + + \ No newline at end of file diff --git a/e2etests/testdata/stable/overlapping_child_label/elk/board.exp.json b/e2etests/testdata/stable/overlapping_child_label/elk/board.exp.json new file mode 100644 index 000000000..9b2579ba4 --- /dev/null +++ b/e2etests/testdata/stable/overlapping_child_label/elk/board.exp.json @@ -0,0 +1,434 @@ +{ + "name": "", + "isFolderOnly": false, + "fontFamily": "SourceSansPro", + "shapes": [ + { + "id": "heyy", + "type": "rectangle", + "pos": { + "x": 12, + "y": 12 + }, + "width": 171, + "height": 302, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "B4", + "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": "heyy", + "fontSize": 28, + "fontFamily": "DEFAULT", + "language": "", + "color": "N1", + "italic": false, + "bold": false, + "underline": false, + "labelWidth": 54, + "labelHeight": 36, + "labelPosition": "INSIDE_BOTTOM_RIGHT", + "zIndex": 0, + "level": 1 + }, + { + "id": "heyy.yo", + "type": "rectangle", + "pos": { + "x": 66, + "y": 62 + }, + "width": 63, + "height": 66, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "B5", + "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": "yo", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "N1", + "italic": false, + "bold": true, + "underline": false, + "labelWidth": 18, + "labelHeight": 21, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 0, + "level": 2 + }, + { + "id": "heyy.hey", + "type": "rectangle", + "pos": { + "x": 62, + "y": 198 + }, + "width": 71, + "height": 66, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "B5", + "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": "hey", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "N1", + "italic": false, + "bold": true, + "underline": false, + "labelWidth": 26, + "labelHeight": 21, + "labelPosition": "OUTSIDE_BOTTOM_RIGHT", + "zIndex": 0, + "level": 2 + }, + { + "id": "ayyy", + "type": "rectangle", + "classes": [ + "icon" + ], + "pos": { + "x": 203, + "y": 42 + }, + "width": 204, + "height": 242, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "B4", + "stroke": "B1", + "shadow": false, + "3d": false, + "multiple": false, + "double-border": false, + "tooltip": "", + "link": "", + "icon": { + "Scheme": "https", + "Opaque": "", + "User": null, + "Host": "icons.terrastruct.com", + "Path": "/essentials/time.svg", + "RawPath": "", + "OmitHost": false, + "ForceQuery": false, + "RawQuery": "", + "Fragment": "", + "RawFragment": "" + }, + "iconPosition": "INSIDE_TOP_LEFT", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "ayyy", + "fontSize": 28, + "fontFamily": "DEFAULT", + "language": "", + "color": "N1", + "italic": false, + "bold": false, + "underline": false, + "labelWidth": 53, + "labelHeight": 36, + "labelPosition": "INSIDE_TOP_RIGHT", + "zIndex": 0, + "level": 1 + }, + { + "id": "ayyy.beee", + "type": "rectangle", + "classes": [ + "icon" + ], + "pos": { + "x": 253, + "y": 116 + }, + "width": 104, + "height": 118, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "B5", + "stroke": "B1", + "shadow": false, + "3d": false, + "multiple": false, + "double-border": false, + "tooltip": "", + "link": "", + "icon": { + "Scheme": "https", + "Opaque": "", + "User": null, + "Host": "icons.terrastruct.com", + "Path": "/essentials/time.svg", + "RawPath": "", + "OmitHost": false, + "ForceQuery": false, + "RawQuery": "", + "Fragment": "", + "RawFragment": "" + }, + "iconPosition": "OUTSIDE_TOP_RIGHT", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "beee", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "N1", + "italic": false, + "bold": true, + "underline": false, + "labelWidth": 33, + "labelHeight": 21, + "labelPosition": "OUTSIDE_TOP_LEFT", + "zIndex": 0, + "level": 2 + }, + { + "id": "ceee", + "type": "rectangle", + "classes": [ + "icon" + ], + "pos": { + "x": 427, + "y": 42 + }, + "width": 205, + "height": 242, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "B4", + "stroke": "B1", + "shadow": false, + "3d": false, + "multiple": false, + "double-border": false, + "tooltip": "", + "link": "", + "icon": { + "Scheme": "https", + "Opaque": "", + "User": null, + "Host": "icons.terrastruct.com", + "Path": "/essentials/time.svg", + "RawPath": "", + "OmitHost": false, + "ForceQuery": false, + "RawQuery": "", + "Fragment": "", + "RawFragment": "" + }, + "iconPosition": "INSIDE_BOTTOM_LEFT", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "ceee", + "fontSize": 28, + "fontFamily": "DEFAULT", + "language": "", + "color": "N1", + "italic": false, + "bold": false, + "underline": false, + "labelWidth": 53, + "labelHeight": 36, + "labelPosition": "INSIDE_TOP_RIGHT", + "zIndex": 0, + "level": 1 + }, + { + "id": "ceee.deee", + "type": "rectangle", + "classes": [ + "icon" + ], + "pos": { + "x": 477, + "y": 92 + }, + "width": 105, + "height": 118, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "B5", + "stroke": "B1", + "shadow": false, + "3d": false, + "multiple": false, + "double-border": false, + "tooltip": "", + "link": "", + "icon": { + "Scheme": "https", + "Opaque": "", + "User": null, + "Host": "icons.terrastruct.com", + "Path": "/essentials/time.svg", + "RawPath": "", + "OmitHost": false, + "ForceQuery": false, + "RawQuery": "", + "Fragment": "", + "RawFragment": "" + }, + "iconPosition": "OUTSIDE_BOTTOM_LEFT", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "deee", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "N1", + "italic": false, + "bold": true, + "underline": false, + "labelWidth": 34, + "labelHeight": 21, + "labelPosition": "OUTSIDE_TOP_RIGHT", + "zIndex": 0, + "level": 2 + } + ], + "connections": [ + { + "id": "heyy.(yo -> hey)[0]", + "src": "heyy.yo", + "srcArrow": "none", + "dst": "heyy.hey", + "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": 97.5, + "y": 128 + }, + { + "x": 97.5, + "y": 198 + } + ], + "animated": false, + "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/stable/overlapping_child_label/elk/sketch.exp.svg b/e2etests/testdata/stable/overlapping_child_label/elk/sketch.exp.svg new file mode 100644 index 000000000..a96791eb4 --- /dev/null +++ b/e2etests/testdata/stable/overlapping_child_label/elk/sketch.exp.svg @@ -0,0 +1,108 @@ +heyyayyyceeeyoheybeeedeee + + + + + + + + + \ No newline at end of file