feat: support axis render

This commit is contained in:
vicanso 2022-06-08 23:19:03 +08:00
parent 4cf494088e
commit b394e1b49f
5 changed files with 344 additions and 39 deletions

View file

@ -417,6 +417,21 @@ func (p *Painter) MeasureText(text string) Box {
return p.render.MeasureText(text)
}
func (p *Painter) MeasureTextMaxWidthHeight(textList []string) (int, int) {
maxWidth := 0
maxHeight := 0
for _, text := range textList {
box := p.MeasureText(text)
if maxWidth < box.Width() {
maxWidth = box.Width()
}
if maxHeight < box.Height() {
maxHeight = box.Height()
}
}
return maxWidth, maxHeight
}
func (p *Painter) LineStroke(points []Point) *Painter {
for index, point := range points {
x := point.X