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:
parent
83b4f7814f
commit
d1d5b99586
1 changed files with 9 additions and 2 deletions
11
qb.js
11
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();
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue