From bd23d0758bb1e2630eb2b1c3d36df483b9bc6c06 Mon Sep 17 00:00:00 2001 From: Gavin Nishizawa Date: Wed, 25 Jan 2023 12:24:56 -0800 Subject: [PATCH] update hexagon inner box --- lib/shape/shape_hexagon.go | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/lib/shape/shape_hexagon.go b/lib/shape/shape_hexagon.go index 8fef2ffc7..3d4492053 100644 --- a/lib/shape/shape_hexagon.go +++ b/lib/shape/shape_hexagon.go @@ -22,10 +22,13 @@ func NewHexagon(box *geo.Box) Shape { func (s shapeHexagon) GetInnerBox() *geo.Box { width := s.Box.Width + height := s.Box.Height tl := s.Box.TopLeft.Copy() - tl.X += width / 4. - width /= 2. - return geo.NewBox(tl, width, s.Box.Height) + tl.X += width / 6. + width /= 1.5 + tl.Y += height / 6. + height /= 1.5 + return geo.NewBox(tl, width, height) } func hexagonPath(box *geo.Box) *svg.SvgPathContext { @@ -52,10 +55,11 @@ func (s shapeHexagon) GetSVGPathData() []string { } func (s shapeHexagon) GetDimensionsToFit(width, height, paddingX, paddingY float64) (float64, float64) { - totalWidth := 2 * (width + paddingX) - return math.Ceil(totalWidth), math.Ceil(height + paddingY) + totalWidth := 1.5 * (width + paddingX) + totalHeight := 1.5 * (height + paddingY) + return math.Ceil(totalWidth), math.Ceil(totalHeight) } func (s shapeHexagon) GetDefaultPadding() (paddingX, paddingY float64) { - return defaultPadding / 4, defaultPadding + return defaultPadding / 2, defaultPadding / 2 }