Download node_modules/d3-geo/src/path/context.js from NKessler/Horizon: direct link, hf CLI and curl.
- Browser
- Download file 920 Bytes
-
https://huggingface.co/NKessler/Horizon/resolve/main/node_modules/d3-geo/src/path/context.js
- Command line
-
hf download hf://NKessler/Horizon/node_modules/d3-geo/src/path/context.js
-
curl -L -o context.js https://huggingface.co/NKessler/Horizon/resolve/main/node_modules/d3-geo/src/path/context.js
920 Bytes
| import {tau} from "../math.js"; | |
| import noop from "../noop.js"; | |
| export default function PathContext(context) { | |
| this._context = context; | |
| } | |
| PathContext.prototype = { | |
| _radius: 4.5, | |
| pointRadius: function(_) { | |
| return this._radius = _, this; | |
| }, | |
| polygonStart: function() { | |
| this._line = 0; | |
| }, | |
| polygonEnd: function() { | |
| this._line = NaN; | |
| }, | |
| lineStart: function() { | |
| this._point = 0; | |
| }, | |
| lineEnd: function() { | |
| if (this._line === 0) this._context.closePath(); | |
| this._point = NaN; | |
| }, | |
| point: function(x, y) { | |
| switch (this._point) { | |
| case 0: { | |
| this._context.moveTo(x, y); | |
| this._point = 1; | |
| break; | |
| } | |
| case 1: { | |
| this._context.lineTo(x, y); | |
| break; | |
| } | |
| default: { | |
| this._context.moveTo(x + this._radius, y); | |
| this._context.arc(x, y, this._radius, 0, tau); | |
| break; | |
| } | |
| } | |
| }, | |
| result: noop | |
| }; | |