eclipse / elk

Eclipse Layout Kernel - Automatic layout for Java applications.
https://www.eclipse.org/elk/
Other
258 stars 86 forks source link

Bug when turning self loop example into JSON #1070

Closed saulshanabrook closed 2 months ago

saulshanabrook commented 3 months ago

Describe the bug

I was trying to see how to replicate the self loop example in JSON. However, if I go and convert it to JSON the resulting graph is not displayed the same.

ELK DSL:

spacing.nodeSelfLoop: 30
spacing.edgeEdge: 10

node n1 {
    portConstraints: FIXED_SIDE
    port p1 { ^port.side: WEST }
    port p2 { ^port.side: EAST }
}

edge n1 -> n1
edge n1 -> n1
edge n1 -> n1

edge n1.p1 -> n1.p2

Converted JSON:

{
  "id": "n0",
  "children": [
    {
      "id": "n1",
      "ports": [
        {
          "id": "p1",
          "layoutOptions": {
            "port.side": "WEST"
          }
        },
        {
          "id": "p2",
          "layoutOptions": {
            "port.side": "EAST"
          }
        }
      ],
      "layoutOptions": {
        "portConstraints": "FIXED_SIDE"
      }
    }
  ],
  "layoutOptions": {
    "spacing.edgeEdge": "10.0",
    "spacing.nodeSelfLoop": "30.0"
  },
  "edges": [
    {
      "id": "e0",
      "sources": [
        "n1"
      ],
      "targets": [
        "n1"
      ]
    },
    {
      "id": "e1",
      "sources": [
        "n1"
      ],
      "targets": [
        "n1"
      ]
    },
    {
      "id": "e2",
      "sources": [
        "n1"
      ],
      "targets": [
        "n1"
      ]
    },
    {
      "id": "e3",
      "sources": [
        "p1"
      ],
      "targets": [
        "p2"
      ]
    }
  ]
}

Expected behavior This is the ELK DSL output:

Screenshot 2024-08-23 at 12 34 49 PM

Screenshots This is the output after converting to JSON:

Screenshot 2024-08-23 at 12 35 18 PM

ELK Version 0.9.3

Additional context

soerendomroes commented 3 months ago

Yes, ELK JSON always needs node sizes specified and this particular viewer does not set a minimum size.