diff --git a/lib/torque/gmaps/torque.js b/lib/torque/gmaps/torque.js index 68f7bde..6a29a46 100644 --- a/lib/torque/gmaps/torque.js +++ b/lib/torque/gmaps/torque.js @@ -321,7 +321,13 @@ GMapsTorqueLayer.prototype = torque.extend({}, * set the cartocss for the current renderer */ setCartoCSS: function(cartocss) { - if (this.provider && this.provider.options.named_map) throw new Error("CartoCSS style on named maps is read-only"); + if (!this.renderer) throw new Error('renderer is not valid'); + + if (this.provider && this.provider.options.named_map) { + 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) { diff --git a/lib/torque/leaflet/torque.js b/lib/torque/leaflet/torque.js index dc27b42..f0010aa 100644 --- a/lib/torque/leaflet/torque.js +++ b/lib/torque/leaflet/torque.js @@ -391,8 +391,13 @@ L.TorqueLayer = L.CanvasLayer.extend({ * set the cartocss for the current renderer */ setCartoCSS: function(cartocss) { - if (this.provider.options.named_map) throw new Error("CartoCSS style on named maps is read-only"); if (!this.renderer) throw new Error('renderer is not valid'); + + if (this.provider.options.named_map) { + console.log('Torque layer: CartoCSS style on named maps is read-only'); + return false; + } + this.renderer.setCartoCSS(cartocss, function () { // provider options var options = torque.common.TorqueLayer.optionsFromLayer(this.renderer._shader.findLayer({ name: 'Map' }));