package shape

import (
	

	
	
	
)

type shapeCallout struct {
	*baseShape
}

const (
	defaultTipWidth  = 30.
	defaultTipHeight = 45.
)

func ( *geo.Box) Shape {
	 := shapeCallout{
		baseShape: &baseShape{
			Type: CALLOUT_TYPE,
			Box:  ,
		},
	}
	.FullShape = go2.Pointer(Shape())
	return 
}

func getTipWidth( *geo.Box) float64 {
	 := defaultTipWidth
	if .Width < *2 {
		 = .Width / 2.0
	}
	return 
}

func getTipHeight( *geo.Box) float64 {
	 := defaultTipHeight
	if .Height < *2 {
		 = .Height / 2.0
	}
	return 
}

func ( shapeCallout) () *geo.Box {
	 := getTipHeight(.Box)
	 := .Box.Height - 
	return geo.NewBox(.Box.TopLeft.Copy(), .Box.Width, )
}

func calloutPath( *geo.Box) *svg.SvgPathContext {
	 := getTipWidth()
	 := getTipHeight()
	 := svg.NewSVGPathContext(.TopLeft, 1, 1)
	.StartAt(.Absolute(0, 0))
	.V(true, .Height-)
	.H(true, .Width/2.0)
	.V(true, )
	.L(true, , -)
	.H(true, .Width/2.0-)
	.V(true, -(.Height - ))
	.H(true, -.Width)
	.Z()
	return 
}

func ( shapeCallout) () []geo.Intersectable {
	return calloutPath(.Box).Path
}

func ( shapeCallout) () []string {
	return []string{
		calloutPath(.Box).PathData(),
	}
}

func ( shapeCallout) (, , ,  float64) (float64, float64) {
	// return the minimum shape dimensions needed to fit content (width x height)
	// in the shape's innerBox with padding
	 :=  + 
	if  < defaultTipHeight {
		 *= 2
	} else {
		 += defaultTipHeight
	}
	return math.Ceil( + ), math.Ceil()
}

func ( shapeCallout) () (,  float64) {
	return defaultPadding, defaultPadding / 2
}