kieler / elkjs

ELK's layout algorithms for JavaScript
Other
1.81k stars 97 forks source link

Duplicate points on edges #305

Open tylerlong opened 3 weeks ago

tylerlong commented 3 weeks ago

Describe the bug There are duplicate points on edges. It makes the SVG marker-end arrow head have a wrong direction.

Screenshot 2024-10-30 at 10 50 55 AM

Reproduce it

You can see that the arrow head on top is facing left, but it is supposed to face down. Root cause is there are two duplicate points on the edge, which makes SVG cannot decide the direction, so it use the default direction.

Expected behavior There shouldn't be duplicate points on an edge.

ELK Version 0.9.3

Additional context

"startPoint": {
            "x": 194.4,
            "y": 210.39999999999998
          },
          "endPoint": {
            "x": 133.6,
            "y": 44
          },
          "bendPoints": [
            {
              "x": 194.4,
              "y": 210.39999999999998
            },
            {
              "x": 194.39999999999998,
              "y": 226.39999999999998
            },
            {
              "x": 163.99999999999994,
              "y": 234.39999999999995
            },
            {
              "x": 133.59999999999997,
              "y": 242.39999999999995
            },
            {
              "x": 72.80000000000001,
              "y": 242.39999999999995
            },
            {
              "x": 42.40000000000002,
              "y": 237.0666666666666
            },
            {
              "x": 12,
              "y": 231.7333333333333
            },
            {
              "x": 12,
              "y": 221.06666666666666
            },
            {
              "x": 12,
              "y": 201.86666666666662
            },
            {
              "x": 12,
              "y": 182.66666666666663
            },
            {
              "x": 12,
              "y": 154.9333333333333
            },
            {
              "x": 12,
              "y": 134.13333333333333
            },
            {
              "x": 12,
              "y": 113.33333333333331
            },
            {
              "x": 12,
              "y": 99.46666666666665
            },
            {
              "x": 12,
              "y": 85.59999999999998
            },
            {
              "x": 12,
              "y": 71.73333333333332
            },
            {
              "x": 12,
              "y": 57.86666666666666
            },
            {
              "x": 12,
              "y": 45.599999999999994
            },
            {
              "x": 12,
              "y": 33.33333333333333
            },
            {
              "x": 12,
              "y": 22.666666666666664
            },
            {
              "x": 32.266666666666666,
              "y": 17.333333333333332
            },
            {
              "x": 52.53333333333333,
              "y": 12
            },
            {
              "x": 93.06666666666666,
              "y": 12
            },
            {
              "x": 113.3333333333333,
              "y": 20
            },
            {
              "x": 133.59999999999997,
              "y": 28
            },
            {
              "x": 133.6,
              "y": 44
            }
          ],

You can see that startPoint === bendPoints[0] and endPoint === bendPoints[bendPoints.length-1].

But this doesn't happen to other edges, only this edge has the issue.

soerendomroes commented 3 weeks ago

This seems to be an issue with the SPLINES edge routing, correct?

tylerlong commented 3 weeks ago

This seems to be an issue with the SPLINES edge routing, correct?

Confirmed. SPLINES edge routing only issue.

soerendomroes commented 3 weeks ago

Thanks, we will investigate.