don't overwrite grid label position
This commit is contained in:
parent
96053458bd
commit
107b556c20
2 changed files with 4 additions and 4 deletions
|
|
@ -89,10 +89,10 @@ func Layout(ctx context.Context, g *d2graph.Graph) error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if obj.HasLabel() {
|
if obj.HasLabel() && obj.LabelPosition == nil {
|
||||||
obj.LabelPosition = go2.Pointer(label.InsideTopCenter.String())
|
obj.LabelPosition = go2.Pointer(label.InsideTopCenter.String())
|
||||||
}
|
}
|
||||||
if obj.Icon != nil {
|
if obj.Icon != nil && obj.IconPosition == nil {
|
||||||
obj.IconPosition = go2.Pointer(label.InsideTopLeft.String())
|
obj.IconPosition = go2.Pointer(label.InsideTopLeft.String())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -119,8 +119,6 @@ func Layout(ctx context.Context, g *d2graph.Graph) error {
|
||||||
g.Root.TopLeft = geo.NewPoint(0, 0)
|
g.Root.TopLeft = geo.NewPoint(0, 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
obj.LabelPosition = go2.Pointer(label.InsideTopCenter.String())
|
|
||||||
|
|
||||||
if g.RootLevel > 0 {
|
if g.RootLevel > 0 {
|
||||||
horizontalPadding, verticalPadding := CONTAINER_PADDING, CONTAINER_PADDING
|
horizontalPadding, verticalPadding := CONTAINER_PADDING, CONTAINER_PADDING
|
||||||
if obj.GridGap != nil || obj.HorizontalGap != nil {
|
if obj.GridGap != nil || obj.HorizontalGap != nil {
|
||||||
|
|
|
||||||
|
|
@ -305,6 +305,8 @@ func ExtractSubgraph(container *d2graph.Object, includeSelf bool) (nestedGraph *
|
||||||
}
|
}
|
||||||
nestedGraph.Root.Attributes = container.Attributes
|
nestedGraph.Root.Attributes = container.Attributes
|
||||||
nestedGraph.Root.Box = &geo.Box{}
|
nestedGraph.Root.Box = &geo.Box{}
|
||||||
|
nestedGraph.Root.LabelPosition = container.LabelPosition
|
||||||
|
nestedGraph.Root.IconPosition = container.IconPosition
|
||||||
|
|
||||||
isNestedObject := func(obj *d2graph.Object) bool {
|
isNestedObject := func(obj *d2graph.Object) bool {
|
||||||
if includeSelf {
|
if includeSelf {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue