moves icon preloading to setShader

This commit is contained in:
Francisco Dans 2015-01-15 17:52:17 +01:00
parent 70a55ebfba
commit 508b75e4da

View File

@ -91,6 +91,8 @@ var carto = global.carto || require('carto');
this._sprites = [];
this._shader = shader;
this._Map = this._shader.getDefault().getStyle({}, { zoom: 0 });
var img_names = this._shader.getImageURLs();
this._preloadIcons(img_names);
},
clearSpriteCache: function() {
@ -124,8 +126,6 @@ var carto = global.carto || require('carto');
var w = ctx.width = canvas.width = ctx.height = canvas.height = Math.ceil(canvasSize);
ctx.translate(w/2, w/2);
var img_names = this._shader.getImageURLs();
this._preloadIcons(img_names);
var img_name = st["marker-file"] || st["point-file"];
if (img_name && this._icons.itemsToLoad === 0) {
var img = this._icons[img_name];