UNPKG

@gravity-ui/graph

Version:

Modern graph editor component

12 lines (11 loc) 280 B
export function polyline(points) { const path = new Path2D(); if (!points.length) { return path; } path.moveTo(points[0].x, points[0].y); for (let i = 1; i < points.length; i++) { path.lineTo(points[i].x, points[i].y); } return path; }