(shape)
| 213 | } |
| 214 | |
| 215 | function getPolygonsPath(shape) { |
| 216 | if (shape.path2d) { |
| 217 | return shape.path2d; |
| 218 | } |
| 219 | if ("svgpath" in shape) { |
| 220 | shape.path2d = new Path2D(shape.svgpath); |
| 221 | } else { |
| 222 | var path = new Path2D(); |
| 223 | for (var polygon of shape.polygons) { |
| 224 | path.moveTo(...polygon[0]); |
| 225 | for (var i = 1; i < polygon.length; i++) { |
| 226 | path.lineTo(...polygon[i]); |
| 227 | } |
| 228 | path.closePath(); |
| 229 | } |
| 230 | shape.path2d = path; |
| 231 | } |
| 232 | return shape.path2d; |
| 233 | } |
| 234 | |
| 235 | function drawPolygonShape(ctx, scalefactor, shape, color) { |
| 236 | ctx.save(); |
no outgoing calls
no test coverage detected