fixes
This commit is contained in:
parent
78ee09f915
commit
ee70180a87
4 changed files with 10 additions and 9 deletions
|
|
@ -296,7 +296,7 @@ func toConnection(edge *d2graph.Edge, theme *d2themes.Theme) d2target.Connection
|
||||||
connection.LabelPosition = *edge.LabelPosition
|
connection.LabelPosition = *edge.LabelPosition
|
||||||
}
|
}
|
||||||
if edge.LabelPercentage != nil {
|
if edge.LabelPercentage != nil {
|
||||||
connection.LabelPercentage = *edge.LabelPercentage
|
connection.LabelPercentage = float64(float32(*edge.LabelPercentage))
|
||||||
}
|
}
|
||||||
connection.Route = make([]*geo.Point, 0, len(edge.Route))
|
connection.Route = make([]*geo.Point, 0, len(edge.Route))
|
||||||
for i := range edge.Route {
|
for i := range edge.Route {
|
||||||
|
|
|
||||||
|
|
@ -244,8 +244,8 @@ func Layout(ctx context.Context, g *d2graph.Graph, opts *ConfigurableOpts) (err
|
||||||
|
|
||||||
// dagre gives center of node
|
// dagre gives center of node
|
||||||
obj.TopLeft = geo.NewPoint(math.Round(dn.X-dn.Width/2), math.Round(dn.Y-dn.Height/2))
|
obj.TopLeft = geo.NewPoint(math.Round(dn.X-dn.Width/2), math.Round(dn.Y-dn.Height/2))
|
||||||
obj.Width = dn.Width
|
obj.Width = math.Ceil(dn.Width)
|
||||||
obj.Height = dn.Height
|
obj.Height = math.Ceil(dn.Height)
|
||||||
|
|
||||||
if obj.HasLabel() {
|
if obj.HasLabel() {
|
||||||
if len(obj.ChildrenArray) > 0 {
|
if len(obj.ChildrenArray) > 0 {
|
||||||
|
|
@ -501,7 +501,7 @@ func Layout(ctx context.Context, g *d2graph.Graph, opts *ConfigurableOpts) (err
|
||||||
if start.X > edge.Src.TopLeft.X+d2target.THREE_DEE_OFFSET &&
|
if start.X > edge.Src.TopLeft.X+d2target.THREE_DEE_OFFSET &&
|
||||||
start.Y < edge.Src.TopLeft.Y+edge.Src.Height-float64(offsetY) {
|
start.Y < edge.Src.TopLeft.Y+edge.Src.Height-float64(offsetY) {
|
||||||
edge.Src.TopLeft.X += d2target.THREE_DEE_OFFSET
|
edge.Src.TopLeft.X += d2target.THREE_DEE_OFFSET
|
||||||
edge.Src.TopLeft.Y -= d2target.THREE_DEE_OFFSET
|
edge.Src.TopLeft.Y -= float64(offsetY)
|
||||||
}
|
}
|
||||||
} else if edge.Src.IsMultiple() {
|
} else if edge.Src.IsMultiple() {
|
||||||
// if the edge is on the multiple part, use the multiple's box for tracing to border
|
// if the edge is on the multiple part, use the multiple's box for tracing to border
|
||||||
|
|
@ -519,7 +519,7 @@ func Layout(ctx context.Context, g *d2graph.Graph, opts *ConfigurableOpts) (err
|
||||||
if end.X > edge.Dst.TopLeft.X+d2target.THREE_DEE_OFFSET &&
|
if end.X > edge.Dst.TopLeft.X+d2target.THREE_DEE_OFFSET &&
|
||||||
end.Y < edge.Dst.TopLeft.Y+edge.Dst.Height-float64(offsetY) {
|
end.Y < edge.Dst.TopLeft.Y+edge.Dst.Height-float64(offsetY) {
|
||||||
edge.Dst.TopLeft.X += d2target.THREE_DEE_OFFSET
|
edge.Dst.TopLeft.X += d2target.THREE_DEE_OFFSET
|
||||||
edge.Dst.TopLeft.Y -= d2target.THREE_DEE_OFFSET
|
edge.Dst.TopLeft.Y -= float64(offsetY)
|
||||||
}
|
}
|
||||||
} else if edge.Dst.IsMultiple() {
|
} else if edge.Dst.IsMultiple() {
|
||||||
// if the edge is on the multiple part, use the multiple's box for tracing to border
|
// if the edge is on the multiple part, use the multiple's box for tracing to border
|
||||||
|
|
|
||||||
|
|
@ -412,8 +412,8 @@ func Layout(ctx context.Context, g *d2graph.Graph, opts *ConfigurableOpts) (err
|
||||||
parentY = parent.TopLeft.Y
|
parentY = parent.TopLeft.Y
|
||||||
}
|
}
|
||||||
obj.TopLeft = geo.NewPoint(parentX+n.X, parentY+n.Y)
|
obj.TopLeft = geo.NewPoint(parentX+n.X, parentY+n.Y)
|
||||||
obj.Width = n.Width
|
obj.Width = math.Ceil(n.Width)
|
||||||
obj.Height = n.Height
|
obj.Height = math.Ceil(n.Height)
|
||||||
|
|
||||||
if obj.HasLabel() {
|
if obj.HasLabel() {
|
||||||
if len(obj.ChildrenArray) > 0 {
|
if len(obj.ChildrenArray) > 0 {
|
||||||
|
|
@ -512,7 +512,7 @@ func Layout(ctx context.Context, g *d2graph.Graph, opts *ConfigurableOpts) (err
|
||||||
if start.X > edge.Src.TopLeft.X+d2target.THREE_DEE_OFFSET &&
|
if start.X > edge.Src.TopLeft.X+d2target.THREE_DEE_OFFSET &&
|
||||||
start.Y < edge.Src.TopLeft.Y+edge.Src.Height-float64(offsetY) {
|
start.Y < edge.Src.TopLeft.Y+edge.Src.Height-float64(offsetY) {
|
||||||
edge.Src.TopLeft.X += d2target.THREE_DEE_OFFSET
|
edge.Src.TopLeft.X += d2target.THREE_DEE_OFFSET
|
||||||
edge.Src.TopLeft.Y -= d2target.THREE_DEE_OFFSET
|
edge.Src.TopLeft.Y -= float64(offsetY)
|
||||||
}
|
}
|
||||||
} else if edge.Src.IsMultiple() {
|
} else if edge.Src.IsMultiple() {
|
||||||
// if the edge is on the multiple part, use the multiple's box for tracing to border
|
// if the edge is on the multiple part, use the multiple's box for tracing to border
|
||||||
|
|
@ -530,7 +530,7 @@ func Layout(ctx context.Context, g *d2graph.Graph, opts *ConfigurableOpts) (err
|
||||||
if end.X > edge.Dst.TopLeft.X+d2target.THREE_DEE_OFFSET &&
|
if end.X > edge.Dst.TopLeft.X+d2target.THREE_DEE_OFFSET &&
|
||||||
end.Y < edge.Dst.TopLeft.Y+edge.Dst.Height-float64(offsetY) {
|
end.Y < edge.Dst.TopLeft.Y+edge.Dst.Height-float64(offsetY) {
|
||||||
edge.Dst.TopLeft.X += d2target.THREE_DEE_OFFSET
|
edge.Dst.TopLeft.X += d2target.THREE_DEE_OFFSET
|
||||||
edge.Dst.TopLeft.Y -= d2target.THREE_DEE_OFFSET
|
edge.Dst.TopLeft.Y -= float64(offsetY)
|
||||||
}
|
}
|
||||||
} else if edge.Dst.IsMultiple() {
|
} else if edge.Dst.IsMultiple() {
|
||||||
// if the edge is on the multiple part, use the multiple's box for tracing to border
|
// if the edge is on the multiple part, use the multiple's box for tracing to border
|
||||||
|
|
|
||||||
|
|
@ -218,6 +218,7 @@ func TraceToShapeBorder(shape Shape, rectBorderPoint, prevPoint *geo.Point) *geo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
closestPoint.TruncateFloat32()
|
||||||
return geo.NewPoint(math.Round(closestPoint.X), math.Round(closestPoint.Y))
|
return geo.NewPoint(math.Round(closestPoint.X), math.Round(closestPoint.Y))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue