0.0.9 dont close already closed paths

This commit is contained in:
Ryan Oldenburg 2020-12-29 18:11:32 -06:00
parent 507cb5fba3
commit e5cc9ba1b5
2 changed files with 6 additions and 2 deletions

View file

@ -1,4 +1,4 @@
version = "0.0.8"
version = "0.0.9"
author = "Andre von Houck and Ryan Oldenburg"
description = "Full-featured 2d graphics library for Nim."
license = "MIT"

View file

@ -508,7 +508,11 @@ iterator segments*(s: seq[Vec2]): Segment =
for i in 0 ..< s.len - 1:
yield(Segment(at: s[i], to: s[i + 1]))
if s.len > 0:
yield(Segment(at: s[^1], to: s[0]))
let
first = s[0]
last = s[^1]
if first != last:
yield(Segment(at: s[^1], to: s[0]))
proc strokePolygons*(ps: seq[seq[Vec2]], strokeWidthR, strokeWidthL: float32): seq[seq[Vec2]] =
## Converts simple polygons into stroked versions: