fix bounding box for multiple

This commit is contained in:
Alexander Wang 2023-01-19 12:39:12 -08:00
parent e5b0a025a5
commit 2966d393ae
No known key found for this signature in database
GPG key ID: D89FA31966BDBECE
4 changed files with 12 additions and 9 deletions

View file

@ -42,8 +42,6 @@ const (
appendixIconRadius = 16
)
var multipleOffset = geo.NewVector(10, -10)
//go:embed tooltip.svg
var TooltipIcon string
@ -689,7 +687,7 @@ func drawShape(writer io.Writer, targetShape d2target.Shape, sketchRunner *d2ske
var multipleTL *geo.Point
if targetShape.Multiple {
multipleTL = tl.AddVector(multipleOffset)
multipleTL = tl.AddVector(geo.NewVector(d2target.MULTIPLE_OFFSET, -d2target.MULTIPLE_OFFSET))
}
switch targetShape.Type {

View file

@ -23,6 +23,7 @@ const (
MAX_ICON_SIZE = 64
THREE_DEE_OFFSET = 15
MULTIPLE_OFFSET = 10
)
type Diagram struct {
@ -73,6 +74,10 @@ func (diagram Diagram) BoundingBox() (topLeft, bottomRight Point) {
y1 = go2.Min(y1, targetShape.Pos.Y-THREE_DEE_OFFSET-targetShape.StrokeWidth)
x2 = go2.Max(x2, targetShape.Pos.X+THREE_DEE_OFFSET+targetShape.Width+targetShape.StrokeWidth)
}
if targetShape.Multiple {
y1 = go2.Min(y1, targetShape.Pos.Y-MULTIPLE_OFFSET-targetShape.StrokeWidth)
x2 = go2.Max(x2, targetShape.Pos.X+MULTIPLE_OFFSET+targetShape.Width+targetShape.StrokeWidth)
}
if targetShape.Label != "" {
labelPosition := label.Position(targetShape.LabelPosition)

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 339 KiB

After

Width:  |  Height:  |  Size: 339 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 338 KiB

After

Width:  |  Height:  |  Size: 338 KiB