From 4fb3feccc252ed9bd1b4b5c79752fb6d2a805ba9 Mon Sep 17 00:00:00 2001 From: LeonardsonCC Date: Tue, 16 May 2023 09:21:24 -0300 Subject: [PATCH] fix shadow cut when 0 padding --- d2target/d2target.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/d2target/d2target.go b/d2target/d2target.go index baa6ffc3e..66121621b 100644 --- a/d2target/d2target.go +++ b/d2target/d2target.go @@ -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)