set cartocss on the startup
This commit is contained in:
parent
b66efd4d74
commit
6423f5f9cf
@ -3,6 +3,7 @@
|
||||
function GMapsTorqueLayer(options) {
|
||||
var self = this;
|
||||
this.key = 0;
|
||||
this.cartocss = null;
|
||||
this.options = _.extend({}, options);
|
||||
_.defaults(this.options, {
|
||||
provider: 'sql_api',
|
||||
@ -62,6 +63,10 @@ GMapsTorqueLayer.prototype = _.extend({},
|
||||
|
||||
this._initTileLoader(this.options.map, this.getProjection());
|
||||
|
||||
if (this.cartocss) {
|
||||
this.renderer.setCartoCSS(this.cartocss);
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
getCanvas: function() {
|
||||
@ -134,9 +139,11 @@ GMapsTorqueLayer.prototype = _.extend({},
|
||||
* set the cartocss for the current renderer
|
||||
*/
|
||||
setCartoCSS: function(cartocss) {
|
||||
if (!this.renderer) throw new Error('renderer is not valid');
|
||||
if (!this.renderer) {
|
||||
this.cartocss = cartocss;
|
||||
return this;
|
||||
}
|
||||
this.renderer.setCartoCSS(cartocss);
|
||||
this.redraw();
|
||||
return this;
|
||||
},
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user