fix: fix axis boundary gap, #13

This commit is contained in:
vicanso 2022-07-11 20:44:28 +08:00
parent 805f4381a3
commit b5b2d37e87

View file

@ -637,12 +637,15 @@ func (p *Painter) MultiText(opt MultiTextOption) *Painter {
} }
count := len(opt.TextList) count := len(opt.TextList)
positionCenter := true positionCenter := true
showIndex := opt.Unit / 2
if containsString([]string{ if containsString([]string{
PositionLeft, PositionLeft,
PositionTop, PositionTop,
}, opt.Position) { }, opt.Position) {
positionCenter = false positionCenter = false
count-- count--
// 非居中
showIndex = 0
} }
width := p.Width() width := p.Width()
height := p.Height() height := p.Height()
@ -653,7 +656,6 @@ func (p *Painter) MultiText(opt MultiTextOption) *Painter {
} else { } else {
values = autoDivide(width, count) values = autoDivide(width, count)
} }
showIndex := opt.Unit / 2
for index, text := range opt.TextList { for index, text := range opt.TextList {
if opt.Unit != 0 && index%opt.Unit != showIndex { if opt.Unit != 0 && index%opt.Unit != showIndex {
continue continue