fix shadow cut when 0 padding

This commit is contained in:
LeonardsonCC 2023-05-16 09:21:24 -03:00
parent 36a8aa679a
commit 4fb3feccc2
No known key found for this signature in database
GPG key ID: C5C03F48C369BD5D

View file

@ -22,6 +22,8 @@ const (
DEFAULT_ICON_SIZE = 32
MAX_ICON_SIZE = 64
SHADOW_SIZE_X = 3
SHADOW_SIZE_Y = 5
THREE_DEE_OFFSET = 15
MULTIPLE_OFFSET = 10
@ -171,6 +173,10 @@ func (diagram Diagram) BoundingBox() (topLeft, bottomRight Point) {
y1 = go2.Min(y1, targetShape.Pos.Y-targetShape.StrokeWidth-16)
x2 = go2.Max(x2, targetShape.Pos.X+targetShape.StrokeWidth+targetShape.Width+16)
}
if targetShape.Shadow {
y2 = go2.Max(y2, targetShape.Pos.Y+targetShape.Height+int(math.Ceil(float64(targetShape.StrokeWidth)/2.))+SHADOW_SIZE_Y)
x2 = go2.Max(x2, targetShape.Pos.X+targetShape.StrokeWidth+targetShape.Width+SHADOW_SIZE_X)
}
if targetShape.ThreeDee {
y1 = go2.Min(y1, targetShape.Pos.Y-THREE_DEE_OFFSET-targetShape.StrokeWidth)