source: node_modules/victory-vendor/lib-vendor/d3-shape/src/curve/linear.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: 900 bytes
Line 
1"use strict";
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6exports.default = _default;
7function Linear(context) {
8 this._context = context;
9}
10Linear.prototype = {
11 areaStart: function () {
12 this._line = 0;
13 },
14 areaEnd: function () {
15 this._line = NaN;
16 },
17 lineStart: function () {
18 this._point = 0;
19 },
20 lineEnd: function () {
21 if (this._line || this._line !== 0 && this._point === 1) this._context.closePath();
22 this._line = 1 - this._line;
23 },
24 point: function (x, y) {
25 x = +x, y = +y;
26 switch (this._point) {
27 case 0:
28 this._point = 1;
29 this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y);
30 break;
31 case 1:
32 this._point = 2;
33 // falls through
34 default:
35 this._context.lineTo(x, y);
36 break;
37 }
38 }
39};
40function _default(context) {
41 return new Linear(context);
42}
Note: See TracBrowser for help on using the repository browser.