From 5d89990119ccb192b8fa653a7853a78f31eeb740 Mon Sep 17 00:00:00 2001 From: rubenmoya Date: Tue, 7 Nov 2017 11:35:17 +0100 Subject: [PATCH] Handle limits error in GMaps --- lib/torque/gmaps/torque.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) 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;