From e17d0c742dbb2c2cbb744f0cbe327778872c2f1f Mon Sep 17 00:00:00 2001 From: Ryan Oldenburg Date: Thu, 11 Feb 2021 01:44:46 -0600 Subject: [PATCH] roundedRect clockwise vs counter --- src/pixie/paths.nim | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/pixie/paths.nim b/src/pixie/paths.nim index c4151d8..c668c61 100644 --- a/src/pixie/paths.nim +++ b/src/pixie/paths.nim @@ -373,11 +373,18 @@ proc roundedRect*( se = min(se, maxRadius) sw = min(sw, maxRadius) - path.moveTo(pos.x + nw, pos.y) - path.arcTo(pos.x + wh.x, pos.y, pos.x + wh.x, pos.y + wh.y, ne) - path.arcTo(pos.x + wh.x, pos.y + wh.y, pos.x, pos.y + wh.y, se) - path.arcTo(pos.x, pos.y + wh.y, pos.x, pos.y, sw) - path.arcTo(pos.x, pos.y, pos.x + wh.x, pos.y, nw) + if clockwise: + path.moveTo(pos.x + nw, pos.y) + path.arcTo(pos.x + wh.x, pos.y, pos.x + wh.x, pos.y + wh.y, ne) + path.arcTo(pos.x + wh.x, pos.y + wh.y, pos.x, pos.y + wh.y, se) + path.arcTo(pos.x, pos.y + wh.y, pos.x, pos.y, sw) + path.arcTo(pos.x, pos.y, pos.x + wh.x, pos.y, nw) + else: + path.moveTo(pos.x + wh.x + ne, pos.y) + path.arcTo(pos.x, pos.y, pos.x, pos.y + wh.y, nw) + path.arcTo(pos.x, pos.y + wh.y, pos.x + wh.x, pos.y + wh.y, sw) + path.arcTo(pos.x + wh.x, pos.y + wh.y, pos.x + wh.x, pos.y, se) + path.arcTo(pos.x + wh.x, pos.y, pos.x, pos.y, ne) path.closePath() proc ellipse*(path: var Path, cx, cy, rx, ry: float32) =