source: node_modules/victory-vendor/lib-vendor/d3-shape/src/curve/cardinalOpen.js

Last change on this file was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago

Added visualizations

  • Property mode set to 100644
File size: 1.5 KB
Line 
1"use strict";
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6exports.CardinalOpen = CardinalOpen;
7exports.default = void 0;
8var _cardinal = require("./cardinal.js");
9function CardinalOpen(context, tension) {
10 this._context = context;
11 this._k = (1 - tension) / 6;
12}
13CardinalOpen.prototype = {
14 areaStart: function () {
15 this._line = 0;
16 },
17 areaEnd: function () {
18 this._line = NaN;
19 },
20 lineStart: function () {
21 this._x0 = this._x1 = this._x2 = this._y0 = this._y1 = this._y2 = NaN;
22 this._point = 0;
23 },
24 lineEnd: function () {
25 if (this._line || this._line !== 0 && this._point === 3) this._context.closePath();
26 this._line = 1 - this._line;
27 },
28 point: function (x, y) {
29 x = +x, y = +y;
30 switch (this._point) {
31 case 0:
32 this._point = 1;
33 break;
34 case 1:
35 this._point = 2;
36 break;
37 case 2:
38 this._point = 3;
39 this._line ? this._context.lineTo(this._x2, this._y2) : this._context.moveTo(this._x2, this._y2);
40 break;
41 case 3:
42 this._point = 4;
43 // falls through
44 default:
45 (0, _cardinal.point)(this, x, y);
46 break;
47 }
48 this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;
49 this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;
50 }
51};
52var _default = exports.default = function custom(tension) {
53 function cardinal(context) {
54 return new CardinalOpen(context, tension);
55 }
56 cardinal.tension = function (tension) {
57 return custom(+tension);
58 };
59 return cardinal;
60}(0);
Note: See TracBrowser for help on using the repository browser.