PHP 7.4.33
Preview: step.js Size: 1.34 KB
/var/www/sitesecurity.bitkit.dk/httpdocs/node_modules/d3-shape/src/curve/step.js
function Step(context, t) {
  this._context = context;
  this._t = t;
}

Step.prototype = {
  areaStart: function() {
    this._line = 0;
  },
  areaEnd: function() {
    this._line = NaN;
  },
  lineStart: function() {
    this._x = this._y = NaN;
    this._point = 0;
  },
  lineEnd: function() {
    if (0 < this._t && this._t < 1 && this._point === 2) this._context.lineTo(this._x, this._y);
    if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();
    if (this._line >= 0) this._t = 1 - this._t, 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: {
        if (this._t <= 0) {
          this._context.lineTo(this._x, y);
          this._context.lineTo(x, y);
        } else {
          var x1 = this._x * (1 - this._t) + x * this._t;
          this._context.lineTo(x1, this._y);
          this._context.lineTo(x1, y);
        }
        break;
      }
    }
    this._x = x, this._y = y;
  }
};

export default function(context) {
  return new Step(context, 0.5);
}

export function stepBefore(context) {
  return new Step(context, 0);
}

export function stepAfter(context) {
  return new Step(context, 1);
}

Directory Contents

Dirs: 0 × Files: 17
Name Size Perms Modified Actions
1.41 KB lrw-r--r-- 2026-04-28 09:11:40
Edit Download
1.50 KB lrw-r--r-- 2026-04-28 09:11:40
Edit Download
1.05 KB lrw-r--r-- 2026-04-28 09:11:40
Edit Download
1.71 KB lrw-r--r-- 2026-04-28 09:11:40
Edit Download
1.06 KB lrw-r--r-- 2026-04-28 09:11:40
Edit Download
1.60 KB lrw-r--r-- 2026-04-28 09:11:40
Edit Download
1.57 KB lrw-r--r-- 2026-04-28 09:11:40
Edit Download
1.27 KB lrw-r--r-- 2026-04-28 09:11:40
Edit Download
2.59 KB lrw-r--r-- 2026-04-28 09:11:40
Edit Download
2.04 KB lrw-r--r-- 2026-04-28 09:11:40
Edit Download
1.73 KB lrw-r--r-- 2026-04-28 09:11:40
Edit Download
744 B lrw-r--r-- 2026-04-28 09:11:40
Edit Download
517 B lrw-r--r-- 2026-04-28 09:11:40
Edit Download
3.13 KB lrw-r--r-- 2026-04-28 09:11:40
Edit Download
1.72 KB lrw-r--r-- 2026-04-28 09:11:40
Edit Download
658 B lrw-r--r-- 2026-04-28 09:11:40
Edit Download
1.34 KB lrw-r--r-- 2026-04-28 09:11:40
Edit Download
If ZipArchive is unavailable, a .tar will be created (no compression).