(ctx, scalefactor, shape, color)
| 233 | } |
| 234 | |
| 235 | function drawPolygonShape(ctx, scalefactor, shape, color) { |
| 236 | ctx.save(); |
| 237 | if (!("svgpath" in shape)) { |
| 238 | ctx.translate(...shape.pos); |
| 239 | ctx.rotate(deg2rad(-shape.angle)); |
| 240 | } |
| 241 | if("filled" in shape && !shape.filled) { |
| 242 | ctx.strokeStyle = color; |
| 243 | ctx.lineWidth = Math.max(1 / scalefactor, shape.width); |
| 244 | ctx.lineCap = "round"; |
| 245 | ctx.lineJoin = "round"; |
| 246 | ctx.stroke(getPolygonsPath(shape)); |
| 247 | } else { |
| 248 | ctx.fillStyle = color; |
| 249 | ctx.fill(getPolygonsPath(shape)); |
| 250 | } |
| 251 | ctx.restore(); |
| 252 | } |
| 253 | |
| 254 | function drawDrawing(ctx, scalefactor, drawing, color) { |
| 255 | if (["segment", "arc", "circle", "curve", "rect"].includes(drawing.type)) { |
no test coverage detected