fix icon padding
This commit is contained in:
parent
92b8404d99
commit
6fe8989d30
1 changed files with 10 additions and 0 deletions
|
|
@ -87,6 +87,16 @@ func (diagram Diagram) BoundingBox() (topLeft, bottomRight Point) {
|
|||
x2 = go2.Max(x2, targetShape.Pos.X+MULTIPLE_OFFSET+targetShape.Width+targetShape.StrokeWidth)
|
||||
}
|
||||
|
||||
if targetShape.Icon != nil && label.Position(targetShape.IconPosition).IsOutside() {
|
||||
contentBox := geo.NewBox(geo.NewPoint(0, 0), float64(targetShape.Width), float64(targetShape.Height))
|
||||
s := shape.NewShape(targetShape.Type, contentBox)
|
||||
size := GetIconSize(s.GetInnerBox(), targetShape.IconPosition)
|
||||
y1 = go2.Min(y1, targetShape.Pos.Y-label.PADDING-size)
|
||||
x1 = go2.Min(x1, targetShape.Pos.X-label.PADDING-size)
|
||||
y2 = go2.Max(y2, targetShape.Pos.Y+label.PADDING+size)
|
||||
x2 = go2.Max(x2, targetShape.Pos.X+label.PADDING+size)
|
||||
}
|
||||
|
||||
if targetShape.Label != "" {
|
||||
labelPosition := label.Position(targetShape.LabelPosition)
|
||||
if !labelPosition.IsOutside() {
|
||||
|
|
|
|||
Loading…
Reference in a new issue