checks itemstoload to be equal or lower than zero, just in case

This commit is contained in:
Francisco Dans 2015-02-02 18:43:33 +01:00
parent 9b421d7d7f
commit 395edc39e0

View File

@ -140,7 +140,7 @@ var filters = require('./torque_filters');
return a.href; return a.href;
}; };
var img_name = qualifyURL(st["marker-file"] || st["point-file"]); var img_name = qualifyURL(st["marker-file"] || st["point-file"]);
if (img_name && this._icons.itemsToLoad === 0) { if (img_name && this._icons.itemsToLoad <= 0) {
var img = this._icons[img_name]; var img = this._icons[img_name];
img.w = st['marker-width'] || img.width; img.w = st['marker-width'] || img.width;
img.h = st['marker-width'] || st['marker-height']; img.h = st['marker-width'] || st['marker-height'];
@ -328,7 +328,7 @@ var filters = require('./torque_filters');
self._icons[this.src] = this; self._icons[this.src] = this;
if (Object.keys(self._icons).length === img_names.length + 1){ if (Object.keys(self._icons).length === img_names.length + 1){
self._icons.itemsToLoad--; self._icons.itemsToLoad--;
if (self._icons.itemsToLoad === 0){ if (self._icons.itemsToLoad <= 0){
self.clearSpriteCache(); self.clearSpriteCache();
self.fire("allIconsLoaded"); self.fire("allIconsLoaded");
} }