first commit
This commit is contained in:
31
node_modules/d3-shape/src/curve/linear.js
generated
vendored
Normal file
31
node_modules/d3-shape/src/curve/linear.js
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
function Linear(context) {
|
||||
this._context = context;
|
||||
}
|
||||
|
||||
Linear.prototype = {
|
||||
areaStart: function() {
|
||||
this._line = 0;
|
||||
},
|
||||
areaEnd: function() {
|
||||
this._line = NaN;
|
||||
},
|
||||
lineStart: function() {
|
||||
this._point = 0;
|
||||
},
|
||||
lineEnd: function() {
|
||||
if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();
|
||||
this._line = 1 - this._line;
|
||||
},
|
||||
point: function(x, y) {
|
||||
x = +x, y = +y;
|
||||
switch (this._point) {
|
||||
case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;
|
||||
case 1: this._point = 2; // falls through
|
||||
default: this._context.lineTo(x, y); break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export default function(context) {
|
||||
return new Linear(context);
|
||||
}
|
||||
Reference in New Issue
Block a user