source: node_modules/d3-shape/src/curve/linear.js@ e4c61dd

Last change on this file since e4c61dd was e4c61dd, checked in by istevanoska <ilinastevanoska@…>, 6 months ago

Prototype 1.1

  • Property mode set to 100644
File size: 744 bytes
Line 
1function Linear(context) {
2 this._context = context;
3}
4
5Linear.prototype = {
6 areaStart: function() {
7 this._line = 0;
8 },
9 areaEnd: function() {
10 this._line = NaN;
11 },
12 lineStart: function() {
13 this._point = 0;
14 },
15 lineEnd: function() {
16 if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();
17 this._line = 1 - this._line;
18 },
19 point: function(x, y) {
20 x = +x, y = +y;
21 switch (this._point) {
22 case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;
23 case 1: this._point = 2; // falls through
24 default: this._context.lineTo(x, y); break;
25 }
26 }
27};
28
29export default function(context) {
30 return new Linear(context);
31}
Note: See TracBrowser for help on using the repository browser.