Merge pull request #276 from CartoDB/issue-cartodb-10964
Don't throw an exception when a named map tries to set a new cartocss over the torque layer
This commit is contained in:
commit
2e1a020c3c
@ -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) {
|
||||
|
@ -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 && 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' }));
|
||||
|
Loading…
Reference in New Issue
Block a user