source: node_modules/victory-vendor/lib-vendor/d3-shape/src/curve/basisOpen.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.3 KB
Line 
1"use strict";
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6exports.default = _default;
7var _basis = require("./basis.js");
8function BasisOpen(context) {
9 this._context = context;
10}
11BasisOpen.prototype = {
12 areaStart: function () {
13 this._line = 0;
14 },
15 areaEnd: function () {
16 this._line = NaN;
17 },
18 lineStart: function () {
19 this._x0 = this._x1 = this._y0 = this._y1 = NaN;
20 this._point = 0;
21 },
22 lineEnd: function () {
23 if (this._line || this._line !== 0 && this._point === 3) this._context.closePath();
24 this._line = 1 - this._line;
25 },
26 point: function (x, y) {
27 x = +x, y = +y;
28 switch (this._point) {
29 case 0:
30 this._point = 1;
31 break;
32 case 1:
33 this._point = 2;
34 break;
35 case 2:
36 this._point = 3;
37 var x0 = (this._x0 + 4 * this._x1 + x) / 6,
38 y0 = (this._y0 + 4 * this._y1 + y) / 6;
39 this._line ? this._context.lineTo(x0, y0) : this._context.moveTo(x0, y0);
40 break;
41 case 3:
42 this._point = 4;
43 // falls through
44 default:
45 (0, _basis.point)(this, x, y);
46 break;
47 }
48 this._x0 = this._x1, this._x1 = x;
49 this._y0 = this._y1, this._y1 = y;
50 }
51};
52function _default(context) {
53 return new BasisOpen(context);
54}
Note: See TracBrowser for help on using the repository browser.