Fix rowCenter calculation in ELK
Co-authored-by: gavin-ts <85081687+gavin-ts@users.noreply.github.com>
This commit is contained in:
parent
28c04bbcb2
commit
b76eaa4433
1 changed files with 5 additions and 3 deletions
|
|
@ -673,9 +673,11 @@ func deleteBends(g *d2graph.Graph) {
|
||||||
// Make sure it's still attached
|
// Make sure it's still attached
|
||||||
switch {
|
switch {
|
||||||
case columnIndex != nil:
|
case columnIndex != nil:
|
||||||
maxRowOffset := endpoint.Height / float64(len(endpoint.SQLTable.Columns)+1) / 3
|
rowHeight := endpoint.Height / float64(len(endpoint.SQLTable.Columns)+1)
|
||||||
rowCenter := endpoint.TopLeft.Y + maxRowOffset*float64(*columnIndex+1)*2 + maxRowOffset
|
rowCenter := endpoint.TopLeft.Y + rowHeight*float64(*columnIndex+1) + rowHeight/2
|
||||||
if math.Abs(end.Y-rowCenter) > maxRowOffset {
|
|
||||||
|
// for row connections new Y coordinate should be within 1/3 row height from the row center
|
||||||
|
if math.Abs(end.Y-rowCenter) > rowHeight/3 {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
case isHorizontal:
|
case isHorizontal:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue