24 lines
No EOL
729 B
JavaScript
24 lines
No EOL
729 B
JavaScript
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
function drawContour(ctx, points, isClosed) {
|
|
if (isClosed === void 0) { isClosed = false; }
|
|
ctx.beginPath();
|
|
points.slice(1).forEach(function (_a, prevIdx) {
|
|
var x = _a.x, y = _a.y;
|
|
var from = points[prevIdx];
|
|
ctx.moveTo(from.x, from.y);
|
|
ctx.lineTo(x, y);
|
|
});
|
|
if (isClosed) {
|
|
var from = points[points.length - 1];
|
|
var to = points[0];
|
|
if (!from || !to) {
|
|
return;
|
|
}
|
|
ctx.moveTo(from.x, from.y);
|
|
ctx.lineTo(to.x, to.y);
|
|
}
|
|
ctx.stroke();
|
|
}
|
|
exports.drawContour = drawContour;
|
|
//# sourceMappingURL=drawContour.js.map
|