mapsense / mapsense.js

Mapsense.js
Other
88 stars 22 forks source link

MultiPoint scaling #16

Closed sttawm closed 9 years ago

sttawm commented 9 years ago

In GeoJson.js, I'm pretty certain this code will not work on MultiPoints.

  var rescales = {

    Point: function (o, e, k) {
      e.setAttribute("transform", "translate(" + o.x + "," + o.y + ")" + k);
    },

    MultiPoint: function (o, e, k) {
      e.setAttribute("transform", "translate(" + o.x + "," + o.y + ")" + k);
    }

  };

It is invoked by:

k = "scale(" + Math.pow(2, tile.zoom - zoom) + ")";
i = -1;
n = (features = tile.features).length;
while (++i < n) rescale((feature = features[i]).data, feature.element, k);
tile.scale = zoom;
sttawm commented 9 years ago

Ah, I see. projectPointsForMultiPoint pre-processes multipoints.