kartograph / kartograph.js

UNMAINTAINED Open source JavaScript renderer for Kartograph SVG maps
http://kartograph.org
GNU Lesser General Public License v3.0
1.51k stars 228 forks source link

Update kartograph.js #70

Open slaweet opened 9 years ago

slaweet commented 9 years ago

I'm using this fix to make kartograph.js work in our app. Other wise it crashes with

Uncaught TypeError: Cannot read property 'length' of null

the null is contours in

 Path = (function() {
    /*
        represents complex polygons (aka multi-polygons)
    */
    function Path(type, contours, closed) {
      var cnt, self, _i, _len;

      if (closed == null) {
        closed = true;
      }
      self = this;
      self.type = type;
      self.contours = [];
      for (_i = 0, _len = contours.length; _i < _len; _i++) {
        cnt = contours[_i];
        if (!__is_clockwise(cnt)) {
          cnt.reverse();
        }
        self.contours.push(cnt);
      }
      self.closed = closed;
    }

I suppose I should make a pull request with changes in your *.coffee source files, but I don't know how to.