laif-ds
Version:
Design System di Laif con componenti React basati su principi di Atomic Design
48 lines (47 loc) • 1.12 kB
JavaScript
"use client";
import { point as h } from "./basis.js";
function e(t) {
this._context = t;
}
e.prototype = {
areaStart: function() {
this._line = 0;
},
areaEnd: function() {
this._line = NaN;
},
lineStart: function() {
this._x0 = this._x1 = this._y0 = this._y1 = NaN, this._point = 0;
},
lineEnd: function() {
(this._line || this._line !== 0 && this._point === 3) && this._context.closePath(), this._line = 1 - this._line;
},
point: function(t, i) {
switch (t = +t, i = +i, this._point) {
case 0:
this._point = 1;
break;
case 1:
this._point = 2;
break;
case 2:
this._point = 3;
var s = (this._x0 + 4 * this._x1 + t) / 6, n = (this._y0 + 4 * this._y1 + i) / 6;
this._line ? this._context.lineTo(s, n) : this._context.moveTo(s, n);
break;
case 3:
this._point = 4;
// falls through
default:
h(this, t, i);
break;
}
this._x0 = this._x1, this._x1 = t, this._y0 = this._y1, this._y1 = i;
}
};
function o(t) {
return new e(t);
}
export {
o as default
};