d3 / d3-shape

Graphical primitives for visualization, such as lines and areas.
https://d3js.org/d3-shape
ISC License
2.48k stars 310 forks source link

CatmullRom.point is called with wrong arguments #78

Closed pallosp closed 8 years ago

pallosp commented 8 years ago

CatmullRom.lineEnd calls CatmullRom.point with 3 arguments while it requires 2.

https://github.com/d3/d3-shape/blob/master/src/curve/catmullRom.js

  lineEnd: function() {
    switch (this._point) {
      case 2: this._context.lineTo(this._x2, this._y2); break;
      case 3: this.point(this, this._x2, this._y2); break;
    }
    if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();
    this._line = 1 - this._line;
  },
  point: function(x, y) {
mbostock commented 8 years ago

Funny enough, but this bug doesn’t have any impact on the behavior of the curve. As a result of passing the wrong argument, this._l23_a is NaN instead of 0 for the last point on the curve. However, this value is only used in the comparison if (that._l23_a > epsilon), and so the behavior is the same.

Of course I will fix this bug. 👍