Merge branch 'master' into gh-1967-column-index

This commit is contained in:
Júlio César Batista 2023-01-06 16:51:19 -03:00
commit c1a7187dc9
No known key found for this signature in database
GPG key ID: 10C4B861BF314878
2 changed files with 11 additions and 0 deletions

View file

@ -10,4 +10,5 @@
- Appendix seperator line no longer added to PNG export when appendix doesn't exist. [#582](https://github.com/terrastruct/d2/pull/582)
- Watch mode only fits to screen on initial load. [#601](https://github.com/terrastruct/d2/pull/601)
- Dimensions (`width`/`height`) were incorrectly giving compiler errors when applied on a shape with style. [#614](https://github.com/terrastruct/d2/pull/614)
- `near` would collide with labels if they were on the diagram boundaries in the same position. [#617](https://github.com/terrastruct/d2/pull/617)
- Fixes routing between sql table columns if the column name is the prefix of the table name [#615](https://github.com/terrastruct/d2/pull/615)

View file

@ -139,6 +139,16 @@ func boundingBox(g *d2graph.Graph) (tl, br *geo.Point) {
y1 = math.Min(y1, obj.TopLeft.Y)
x2 = math.Max(x2, obj.TopLeft.X+obj.Width)
y2 = math.Max(y2, obj.TopLeft.Y+obj.Height)
if obj.Attributes.Label.Value != "" && obj.LabelPosition != nil {
labelPosition := label.Position(*obj.LabelPosition)
if labelPosition.IsOutside() {
labelTL := labelPosition.GetPointOnBox(obj.Box, label.PADDING, float64(*obj.LabelWidth), float64(*obj.LabelHeight))
x1 = math.Min(x1, labelTL.X)
y1 = math.Min(y1, labelTL.Y)
x2 = math.Max(x2, labelTL.X+float64(*obj.LabelWidth))
y2 = math.Max(y2, labelTL.Y+float64(*obj.LabelHeight))
}
}
}
}