Merge pull request #1326 from LeonardsonCC/master
fix: shadow cut when 0 padding
This commit is contained in:
commit
0121efeb21
4 changed files with 14 additions and 6 deletions
|
|
@ -9,3 +9,5 @@
|
||||||
- Improves grid layout performance when there are many similarly sized shapes. [#1315](https://github.com/terrastruct/d2/pull/1315)
|
- Improves grid layout performance when there are many similarly sized shapes. [#1315](https://github.com/terrastruct/d2/pull/1315)
|
||||||
|
|
||||||
#### Bugfixes ⛑️
|
#### Bugfixes ⛑️
|
||||||
|
|
||||||
|
- Shadow is cut off when `--pad` is 0 [#1326](https://github.com/terrastruct/d2/pull/1326)
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,8 @@ const (
|
||||||
DEFAULT_ICON_SIZE = 32
|
DEFAULT_ICON_SIZE = 32
|
||||||
MAX_ICON_SIZE = 64
|
MAX_ICON_SIZE = 64
|
||||||
|
|
||||||
|
SHADOW_SIZE_X = 3
|
||||||
|
SHADOW_SIZE_Y = 5
|
||||||
THREE_DEE_OFFSET = 15
|
THREE_DEE_OFFSET = 15
|
||||||
MULTIPLE_OFFSET = 10
|
MULTIPLE_OFFSET = 10
|
||||||
|
|
||||||
|
|
@ -171,6 +173,10 @@ func (diagram Diagram) BoundingBox() (topLeft, bottomRight Point) {
|
||||||
y1 = go2.Min(y1, targetShape.Pos.Y-targetShape.StrokeWidth-16)
|
y1 = go2.Min(y1, targetShape.Pos.Y-targetShape.StrokeWidth-16)
|
||||||
x2 = go2.Max(x2, targetShape.Pos.X+targetShape.StrokeWidth+targetShape.Width+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.Width+int(math.Ceil(float64(targetShape.StrokeWidth)/2.))+SHADOW_SIZE_X)
|
||||||
|
}
|
||||||
|
|
||||||
if targetShape.ThreeDee {
|
if targetShape.ThreeDee {
|
||||||
y1 = go2.Min(y1, targetShape.Pos.Y-THREE_DEE_OFFSET-targetShape.StrokeWidth)
|
y1 = go2.Min(y1, targetShape.Pos.Y-THREE_DEE_OFFSET-targetShape.StrokeWidth)
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
File diff suppressed because one or more lines are too long
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
Loading…
Reference in a new issue