d3 / d3-geo

Geographic projections, spherical shapes and spherical trigonometry.

Home Page:https://d3js.org/d3-geo

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Buffer: Drop point information in unexpected circumstances.

martinfrances107 opened this issue · comments

While working out a bug in my own code. I came across some unexpected behaviour from

src/clip/buffer.js

Admittedly the mistake was on my side... but I was expecting a different response from the library.

My error .. I was calling

buffer.point()

before a call to

buffer.lineStart()

My own thinking about this bad senario is that we should silently drop the input.

The current behaviour we generate a TYPE error

line is undefined so this method blow up.

    point: function(x, y, m) {
      line.push([x, y, m]);
    },

I will write a patch soon ... but I just wanted to canvas opinion before I change the behaviour.

I don't think we want to add tests here, at least in the JS version; and it's rather convenient to have an error if the API is not consumed correctly?

Fair enough.