Don't throw an exception when a named map tries to set a new cartocss
This commit is contained in:
parent
65a115e9b1
commit
62fc84b9be
@ -321,7 +321,13 @@ GMapsTorqueLayer.prototype = torque.extend({},
|
|||||||
* set the cartocss for the current renderer
|
* set the cartocss for the current renderer
|
||||||
*/
|
*/
|
||||||
setCartoCSS: function(cartocss) {
|
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);
|
var shader = new carto.RendererJS().render(cartocss);
|
||||||
this.shader = shader;
|
this.shader = shader;
|
||||||
if (this.renderer) {
|
if (this.renderer) {
|
||||||
|
@ -391,8 +391,13 @@ L.TorqueLayer = L.CanvasLayer.extend({
|
|||||||
* set the cartocss for the current renderer
|
* set the cartocss for the current renderer
|
||||||
*/
|
*/
|
||||||
setCartoCSS: function(cartocss) {
|
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.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 () {
|
this.renderer.setCartoCSS(cartocss, function () {
|
||||||
// provider options
|
// provider options
|
||||||
var options = torque.common.TorqueLayer.optionsFromLayer(this.renderer._shader.findLayer({ name: 'Map' }));
|
var options = torque.common.TorqueLayer.optionsFromLayer(this.renderer._shader.findLayer({ name: 'Map' }));
|
||||||
|
Loading…
Reference in New Issue
Block a user