update hexagon inner box

This commit is contained in:
Gavin Nishizawa 2023-01-25 12:24:56 -08:00
parent 597bc319bf
commit bd23d0758b
No known key found for this signature in database
GPG key ID: AE3B177777CE55CD

View file

@ -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
}