set cartocss on the startup

This commit is contained in:
javi 2013-08-29 13:06:56 +02:00
parent b66efd4d74
commit 6423f5f9cf

View File

@ -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;
},