This commit is contained in:
satoqz 2023-05-08 22:57:27 +02:00
parent 14f88e2db9
commit 870ede1e1e
No known key found for this signature in database

View file

@ -1036,9 +1036,11 @@ func (obj *Object) GetDefaultSize(mtexts []*d2target.MText, ruler *textmeasure.R
}
maxTypeWidth = go2.Max(maxTypeWidth, typeDims.Width)
// 60 covers UNQ constraint with padding, 40 for further constraints covers UNQ + space
if newWidth := 60 + 40*(len(c.Constraint)-1); newWidth > constraintWidth {
constraintWidth = newWidth
if l := len(c.Constraint); l > 0 {
// 60 covers UNQ constraint with padding, 40 for further constraints covers UNQ + space
if newWidth := 60 + 40*(l-1); newWidth > constraintWidth {
constraintWidth = newWidth
}
}
}