| 242 | } |
| 243 | |
| 244 | protected createPath(expand = 0) { |
| 245 | const path = new Path2D(); |
| 246 | const start = this.startAngle() * DEG2RAD; |
| 247 | let end = this.endAngle() * DEG2RAD; |
| 248 | const size = this.size().scale(0.5).add(expand); |
| 249 | const closed = this.closed(); |
| 250 | |
| 251 | if (end > start + Math.PI * 2) { |
| 252 | const loops = Math.floor((end - start) / (Math.PI * 2)); |
| 253 | end -= Math.PI * 2 * loops; |
| 254 | } |
| 255 | |
| 256 | if (closed) { |
| 257 | path.moveTo(0, 0); |
| 258 | } |
| 259 | path.ellipse(0, 0, size.x, size.y, 0, start, end, this.counterclockwise()); |
| 260 | if (closed) { |
| 261 | path.closePath(); |
| 262 | } |
| 263 | |
| 264 | return path; |
| 265 | } |
| 266 | } |