source: node_modules/victory-vendor/lib-vendor/d3-shape/src/curve/basisClosed.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.9 KB
Line 
1"use strict";
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6exports.default = _default;
7var _noop = _interopRequireDefault(require("../noop.js"));
8var _basis = require("./basis.js");
9function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10function BasisClosed(context) {
11 this._context = context;
12}
13BasisClosed.prototype = {
14 areaStart: _noop.default,
15 areaEnd: _noop.default,
16 lineStart: function () {
17 this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = NaN;
18 this._point = 0;
19 },
20 lineEnd: function () {
21 switch (this._point) {
22 case 1:
23 {
24 this._context.moveTo(this._x2, this._y2);
25 this._context.closePath();
26 break;
27 }
28 case 2:
29 {
30 this._context.moveTo((this._x2 + 2 * this._x3) / 3, (this._y2 + 2 * this._y3) / 3);
31 this._context.lineTo((this._x3 + 2 * this._x2) / 3, (this._y3 + 2 * this._y2) / 3);
32 this._context.closePath();
33 break;
34 }
35 case 3:
36 {
37 this.point(this._x2, this._y2);
38 this.point(this._x3, this._y3);
39 this.point(this._x4, this._y4);
40 break;
41 }
42 }
43 },
44 point: function (x, y) {
45 x = +x, y = +y;
46 switch (this._point) {
47 case 0:
48 this._point = 1;
49 this._x2 = x, this._y2 = y;
50 break;
51 case 1:
52 this._point = 2;
53 this._x3 = x, this._y3 = y;
54 break;
55 case 2:
56 this._point = 3;
57 this._x4 = x, this._y4 = y;
58 this._context.moveTo((this._x0 + 4 * this._x1 + x) / 6, (this._y0 + 4 * this._y1 + y) / 6);
59 break;
60 default:
61 (0, _basis.point)(this, x, y);
62 break;
63 }
64 this._x0 = this._x1, this._x1 = x;
65 this._y0 = this._y1, this._y1 = y;
66 }
67};
68function _default(context) {
69 return new BasisClosed(context);
70}
Note: See TracBrowser for help on using the repository browser.