This commit is contained in:
Francisco Dans 2015-01-08 16:51:21 +01:00
commit 368f5b1526

View File

@ -52,7 +52,6 @@ var carto = global.carto || require('carto');
this.setCartoCSS(this.options.cartocss || DEFAULT_CARTOCSS);
this.TILE_SIZE = 256;
this._icons = {};
this._iconNames = [];
}
torque.extend(PointRenderer.prototype, torque.Event, {
@ -315,6 +314,33 @@ var carto = global.carto || require('carto');
}
}
return null;
},
_preloadIcons: function(){
var img_name = this._shader.layers[1].shader["marker-file"];
var imagesToLoad = 1;
if(img_name && !(img_name in this._icons)){
var new_img = new Image();
new_img.onload(function(){
imagesToLoad--;
if(imagesToLoad == 0){
this.fire("iconsloaded");
}
});
new_img.src = img_name;
this._icons[img_name] = new_img;
}
else{
this.fire("iconsloaded");
}
// TODO: get icons for conditional styles too
// if (typeof obj["marker-file"] !== 'undefined'){
// iconFiles.push(obj["marker-file"]);
// }
// for(var i = 0; i< layers.length){
// }
// }
}
});