changes
This commit is contained in:
parent
c546cf0224
commit
fc3b7286a8
1 changed files with 14 additions and 6 deletions
|
|
@ -1241,17 +1241,25 @@ func (g *Graph) SetDimensions(mtexts []*d2target.MText, ruler *textmeasure.Ruler
|
||||||
s := shape.NewShape(shapeType, contentBox)
|
s := shape.NewShape(shapeType, contentBox)
|
||||||
|
|
||||||
paddingX, paddingY := s.GetDefaultPadding()
|
paddingX, paddingY := s.GetDefaultPadding()
|
||||||
if desiredWidth != 0 || desiredHeight != 0 {
|
if desiredWidth != 0 {
|
||||||
paddingX = 0.
|
paddingX = 0.
|
||||||
|
}
|
||||||
|
if desiredHeight != 0 {
|
||||||
paddingY = 0.
|
paddingY = 0.
|
||||||
} else {
|
}
|
||||||
// give shapes with icons extra padding to fit their label
|
|
||||||
if obj.Attributes.Icon != nil {
|
// give shapes with icons extra padding to fit their label
|
||||||
labelHeight := float64(labelDims.Height + INNER_LABEL_PADDING)
|
if obj.Attributes.Icon != nil {
|
||||||
// Evenly pad enough to fit label above icon
|
labelHeight := float64(labelDims.Height + INNER_LABEL_PADDING)
|
||||||
|
// Evenly pad enough to fit label above icon
|
||||||
|
if desiredWidth == 0 {
|
||||||
paddingX += labelHeight
|
paddingX += labelHeight
|
||||||
|
}
|
||||||
|
if desiredHeight == 0 {
|
||||||
paddingY += labelHeight
|
paddingY += labelHeight
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if desiredWidth == 0 {
|
||||||
switch shapeType {
|
switch shapeType {
|
||||||
case shape.TABLE_TYPE, shape.CLASS_TYPE, shape.CODE_TYPE, shape.IMAGE_TYPE:
|
case shape.TABLE_TYPE, shape.CLASS_TYPE, shape.CODE_TYPE, shape.IMAGE_TYPE:
|
||||||
default:
|
default:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue