MCPcopy Create free account
hub / github.com/openscopeproject/InteractiveHtmlBom / getPolygonsPath

Function getPolygonsPath

InteractiveHtmlBom/web/render.js:215–233  ·  view source on GitHub ↗
(shape)

Source from the content-addressed store, hash-verified

213}
214
215function 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
235function drawPolygonShape(ctx, scalefactor, shape, color) {
236 ctx.save();

Callers 4

drawTextFunction · 0.85
drawPolygonShapeFunction · 0.85
getCachedPadPathFunction · 0.85
drawZonesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected