Skip to content

Commit e9fc997

Browse files
authored
add back drawCircle
1 parent 6f8b0cc commit e9fc997

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

common/DrawHelper.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ caDrawHelper.prototype.drawMultiline = function(ctx,array){
8282
this.drawLine(ctx,array[i-1],array[i]);
8383
}
8484
}
85+
86+
// NOTE:: circle is for a circle object, drawCircle is for the joining circles
8587
caDrawHelper.prototype.circle = function(ctx, point, radius, isPoint=true){
8688

8789

@@ -101,6 +103,27 @@ caDrawHelper.prototype.circle = function(ctx, point, radius, isPoint=true){
101103
return path;
102104
}
103105

106+
/**
107+
* draw a circle
108+
* @param {CanvasRenderingContext2D} ctx
109+
* is used for drawing rectangles, text, images and other objects onto the canvas element
110+
* @param {Number} cx
111+
* The x-coordinate of the center of the circle
112+
* @param {Number} xy
113+
* The x-coordinate of the center of the circle
114+
* @param {Number} r
115+
* The radius of the circle
116+
*/
117+
caDrawHelper.prototype.drawCircle = function(ctx, cx, cy, r){
118+
// draw line
119+
ctx.beginPath();
120+
ctx.arc(cx, cy, r, 0, 2 * Math.PI);
121+
ctx.stroke();
122+
ctx.closePath();
123+
124+
}
125+
126+
104127
// rotation in radians
105128
caDrawHelper.prototype.ellipse = function(ctx, point, radius, rotation){
106129
const path = new Path();

0 commit comments

Comments
 (0)