From ff5c812f080dc148f104279eed3975e0acfd7cb5 Mon Sep 17 00:00:00 2001 From: Jordan Martinez Date: Wed, 22 Sep 2021 08:48:27 -0700 Subject: [PATCH 1/2] Support counter-clockwise arcs --- src/Graphics/Canvas.js | 2 +- src/Graphics/Canvas.purs | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Graphics/Canvas.js b/src/Graphics/Canvas.js index 73b25c9..158a2ba 100644 --- a/src/Graphics/Canvas.js +++ b/src/Graphics/Canvas.js @@ -229,7 +229,7 @@ exports.closePath = function(ctx) { exports.arc = function(ctx) { return function(a) { return function() { - ctx.arc(a.x, a.y, a.radius, a.start, a.end); + ctx.arc(a.x, a.y, a.radius, a.start, a.end, a.useCounterClockwise); }; }; }; diff --git a/src/Graphics/Canvas.purs b/src/Graphics/Canvas.purs index 1d0d6a1..9d29d70 100644 --- a/src/Graphics/Canvas.purs +++ b/src/Graphics/Canvas.purs @@ -415,12 +415,15 @@ fillPath ctx path = do -- | - The center coordinates `x` and `y`, -- | - The radius `r`, -- | - The starting and ending angles, `start` and `end`. +-- | - Whether to draw the arc counter-clockwise (true) or clockwise (false) direction. +-- | Normally, this value is `false`. type Arc = { x :: Number , y :: Number , radius :: Number , start :: Number , end :: Number + , useCounterClockwise :: Boolean } -- | Render an arc object. From 3fe0fb456fcffbebfd710e26d0c5fcad89738bdd Mon Sep 17 00:00:00 2001 From: Jordan Martinez Date: Wed, 22 Sep 2021 08:50:33 -0700 Subject: [PATCH 2/2] Update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ce6fd4f..471806f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ Notable changes to this project are documented in this file. The format is based ## [Unreleased] Breaking changes: +- Support arcs that are drawn counter-clockwise (#58, #83 by @karljs and @JordanMartinez) New features: - Added `createImageDataWith` (#81)