Sha256: 7f64f989bc71b29664ed84727a9fd4a8a6ea5deafeb8d19312d7a14317f4b915
Contents?: true
Size: 1017 Bytes
Versions: 4
Compression:
Stored size: 1017 Bytes
Contents
import "../core/noop"; import "../math/trigonometry"; function d3_geo_pathContext(context) { var pointRadius = 4.5; var stream = { point: point, // While inside a line, override point to moveTo then lineTo. lineStart: function() { stream.point = pointLineStart; }, lineEnd: lineEnd, // While inside a polygon, override lineEnd to closePath. polygonStart: function() { stream.lineEnd = lineEndPolygon; }, polygonEnd: function() { stream.lineEnd = lineEnd; stream.point = point; }, pointRadius: function(_) { pointRadius = _; return stream; }, result: d3_noop }; function point(x, y) { context.moveTo(x, y); context.arc(x, y, pointRadius, 0, 2 * π); } function pointLineStart(x, y) { context.moveTo(x, y); stream.point = pointLine; } function pointLine(x, y) { context.lineTo(x, y); } function lineEnd() { stream.point = point; } function lineEndPolygon() { context.closePath(); } return stream; }
Version data entries
4 entries across 4 versions & 2 rubygems