update hexagon inner box
This commit is contained in:
parent
597bc319bf
commit
bd23d0758b
1 changed files with 10 additions and 6 deletions
|
|
@ -22,10 +22,13 @@ func NewHexagon(box *geo.Box) Shape {
|
||||||
|
|
||||||
func (s shapeHexagon) GetInnerBox() *geo.Box {
|
func (s shapeHexagon) GetInnerBox() *geo.Box {
|
||||||
width := s.Box.Width
|
width := s.Box.Width
|
||||||
|
height := s.Box.Height
|
||||||
tl := s.Box.TopLeft.Copy()
|
tl := s.Box.TopLeft.Copy()
|
||||||
tl.X += width / 4.
|
tl.X += width / 6.
|
||||||
width /= 2.
|
width /= 1.5
|
||||||
return geo.NewBox(tl, width, s.Box.Height)
|
tl.Y += height / 6.
|
||||||
|
height /= 1.5
|
||||||
|
return geo.NewBox(tl, width, height)
|
||||||
}
|
}
|
||||||
|
|
||||||
func hexagonPath(box *geo.Box) *svg.SvgPathContext {
|
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) {
|
func (s shapeHexagon) GetDimensionsToFit(width, height, paddingX, paddingY float64) (float64, float64) {
|
||||||
totalWidth := 2 * (width + paddingX)
|
totalWidth := 1.5 * (width + paddingX)
|
||||||
return math.Ceil(totalWidth), math.Ceil(height + paddingY)
|
totalHeight := 1.5 * (height + paddingY)
|
||||||
|
return math.Ceil(totalWidth), math.Ceil(totalHeight)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s shapeHexagon) GetDefaultPadding() (paddingX, paddingY float64) {
|
func (s shapeHexagon) GetDefaultPadding() (paddingX, paddingY float64) {
|
||||||
return defaultPadding / 4, defaultPadding
|
return defaultPadding / 2, defaultPadding / 2
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue