1
1
Fork 0
mirror of https://github.com/boxgaming/qbjs.git synced 2024-09-20 04:24:45 +00:00

Implemented aspect parameter in sub_Circle.

This commit is contained in:
William Barnes 2022-04-21 23:18:53 -04:00
parent 83b4f7814f
commit d1d5b99586

11
qb.js
View file

@ -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();
};