diff --git a/lib/torque/gmaps/torque.js b/lib/torque/gmaps/torque.js index eb9e687..6eed21f 100644 --- a/lib/torque/gmaps/torque.js +++ b/lib/torque/gmaps/torque.js @@ -180,7 +180,7 @@ GMapsTorqueLayer.prototype = torque.extend({}, // for each tile shown on the map request the data onTileAdded: function(t) { var self = this; - this.provider.getTileData(t, t.zoom, function(tileData) { + var successCallback = function (tileData) { // don't load tiles that are not being shown if (t.zoom !== self.map.getZoom()) return; self._tileLoaded(t, tileData); @@ -188,7 +188,12 @@ GMapsTorqueLayer.prototype = torque.extend({}, if (tileData) { self.redraw(); } - }); + }; + var errorCallback = function (error) { + self.fire('tileError', error); + } + + this.provider.getTileData(t, t.zoom, successCallback, errorCallback); }, clear: function() { @@ -325,7 +330,7 @@ GMapsTorqueLayer.prototype = torque.extend({}, console.log('Torque layer: CartoCSS style on named maps is read-only'); return false; } - + var shader = new carto.RendererJS().render(cartocss); this.shader = shader; if (this.renderer) { @@ -406,7 +411,7 @@ GMapsTorqueLayer.prototype = torque.extend({}, } return c; }, - + getValueForBBox: function(x, y, w, h) { var xf = x + w, yf = y + h; var sum = 0;