bugfix in ClosePath
This commit is contained in:
parent
e37f4f5565
commit
3a0ca2cdcd
1 changed files with 3 additions and 4 deletions
|
@ -372,9 +372,6 @@ func (p *Path2D) ClosePath() {
|
||||||
if len(p.p) < 2 {
|
if len(p.p) < 2 {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if isSamePoint(p.p[len(p.p)-1].pos, p.p[0].pos, 0.1) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
closeIdx := 0
|
closeIdx := 0
|
||||||
for i := len(p.p) - 1; i >= 0; i-- {
|
for i := len(p.p) - 1; i >= 0; i-- {
|
||||||
if p.p[i].flags&pathMove != 0 {
|
if p.p[i].flags&pathMove != 0 {
|
||||||
|
@ -382,7 +379,9 @@ func (p *Path2D) ClosePath() {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
p.LineTo(p.p[closeIdx].pos[0], p.p[closeIdx].pos[1])
|
if !isSamePoint(p.p[len(p.p)-1].pos, p.p[0].pos, 0.1) {
|
||||||
|
p.LineTo(p.p[closeIdx].pos[0], p.p[closeIdx].pos[1])
|
||||||
|
}
|
||||||
p.p[len(p.p)-1].next = p.p[closeIdx].next
|
p.p[len(p.p)-1].next = p.p[closeIdx].next
|
||||||
p.p[len(p.p)-1].flags |= pathAttach
|
p.p[len(p.p)-1].flags |= pathAttach
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue