From d1d5b995866164d580cf276a41035fea6707f16c Mon Sep 17 00:00:00 2001 From: William Barnes Date: Thu, 21 Apr 2022 23:18:53 -0400 Subject: [PATCH] Implemented aspect parameter in sub_Circle. --- qb.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/qb.js b/qb.js index d0aeb7e..49c88af 100644 --- a/qb.js +++ b/qb.js @@ -719,7 +719,6 @@ var QB = new function() { }; this.sub_Circle = function(step, x, y, radius, color, startAngle, endAngle, aspect) { - // TODO: implement aspect parameter var screen = _images[_activeImage]; if (color == undefined) { @@ -742,7 +741,15 @@ var QB = new function() { var ctx = screen.ctx; ctx.strokeStyle = color.rgba(); ctx.beginPath(); - ctx.arc(x, y, radius, startAngle, endAngle); + if (aspect == undefined) { + ctx.arc(x, y, radius, -endAngle, -startAngle); + } else { + if (aspect < 1) { + ctx.ellipse(x, y, radius, radius * aspect, 0, -endAngle, -startAngle); + } else { + ctx.ellipse(x, y, radius / aspect, radius, 0, -endAngle, -startAngle); + } + } ctx.stroke(); };