try
This commit is contained in:
parent
314844c6d1
commit
357befa313
5 changed files with 2660 additions and 1846 deletions
|
|
@ -12,7 +12,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
MIN_RADIUS = 100
|
MIN_RADIUS = 200
|
||||||
PADDING = 20
|
PADDING = 20
|
||||||
MIN_SEGMENT_LEN = 10
|
MIN_SEGMENT_LEN = 10
|
||||||
ARC_STEPS = 100
|
ARC_STEPS = 100
|
||||||
|
|
@ -105,13 +105,11 @@ func createCircularArc(edge *d2graph.Edge) {
|
||||||
edge.Route = path
|
edge.Route = path
|
||||||
edge.IsCurve = true
|
edge.IsCurve = true
|
||||||
|
|
||||||
// Adjust the last segment to ensure proper arrowhead direction
|
|
||||||
if len(edge.Route) >= 2 {
|
if len(edge.Route) >= 2 {
|
||||||
lastIndex := len(edge.Route) - 1
|
lastIndex := len(edge.Route) - 1
|
||||||
lastPoint := edge.Route[lastIndex]
|
lastPoint := edge.Route[lastIndex]
|
||||||
secondLastPoint := edge.Route[lastIndex-1]
|
secondLastPoint := edge.Route[lastIndex-1]
|
||||||
|
|
||||||
// Calculate tangent direction (perpendicular to radius vector)
|
|
||||||
tangentX := -lastPoint.Y
|
tangentX := -lastPoint.Y
|
||||||
tangentY := lastPoint.X
|
tangentY := lastPoint.X
|
||||||
mag := math.Hypot(tangentX, tangentY)
|
mag := math.Hypot(tangentX, tangentY)
|
||||||
|
|
@ -120,7 +118,7 @@ func createCircularArc(edge *d2graph.Edge) {
|
||||||
tangentY /= mag
|
tangentY /= mag
|
||||||
}
|
}
|
||||||
const MIN_SEGMENT_LEN = 4.255
|
const MIN_SEGMENT_LEN = 4.255
|
||||||
// Calculate current segment direction
|
|
||||||
dx := lastPoint.X - secondLastPoint.X
|
dx := lastPoint.X - secondLastPoint.X
|
||||||
dy := lastPoint.Y - secondLastPoint.Y
|
dy := lastPoint.Y - secondLastPoint.Y
|
||||||
segLength := math.Hypot(dx, dy)
|
segLength := math.Hypot(dx, dy)
|
||||||
|
|
|
||||||
2078
e2etests/testdata/txtar/cycle-diagram/dagre/board.exp.json
generated
vendored
2078
e2etests/testdata/txtar/cycle-diagram/dagre/board.exp.json
generated
vendored
File diff suppressed because it is too large
Load diff
File diff suppressed because one or more lines are too long
|
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 26 KiB |
2078
e2etests/testdata/txtar/cycle-diagram/elk/board.exp.json
generated
vendored
2078
e2etests/testdata/txtar/cycle-diagram/elk/board.exp.json
generated
vendored
File diff suppressed because it is too large
Load diff
File diff suppressed because one or more lines are too long
|
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 26 KiB |
Loading…
Reference in a new issue