tweak constraint width calculation

This commit is contained in:
satoqz 2023-05-01 14:13:52 +02:00
parent fd8eee7219
commit c9517b1978
No known key found for this signature in database

View file

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