runs custom url qualifier if there is one provided

This commit is contained in:
Francisco Dans 2015-02-10 13:30:35 +01:00
parent 3f33dc3428
commit c82c55affd

View File

@ -134,12 +134,7 @@ var filters = require('./torque_filters');
var w = ctx.width = canvas.width = ctx.height = canvas.height = Math.ceil(canvasSize);
ctx.translate(w/2, w/2);
function qualifyURL(url) {
var a = self._getDocument().createElement('a');
a.href = url;
return a.href;
};
var img_name = qualifyURL(st["marker-file"] || st["point-file"]);
var img_name = this._qualifyURL(st["marker-file"] || st["point-file"]);
if (img_name && this._icons.itemsToLoad === 0) {
var img = this._icons[img_name];
img.w = st['marker-width'] || img.width;
@ -197,11 +192,15 @@ var filters = require('./torque_filters');
? new this.options.imageClass()
: new Image();
},
_getDocument: function() {
return typeof this.options.document !== 'undefined'
? this.options.document
: document;
_qualifyURL: function(url) {
if (typeof this.options.qualifyURL !== "undefined"){
return this.options.qualifyURL(url);
}
else{
var a = document.createElement('a');
a.href = url;
return a.href;
}
},
//
@ -320,12 +319,7 @@ var filters = require('./torque_filters');
if (img_names.length > 0 && !this._forcePoints){
for (var i = 0; i<img_names.length; i++){
var new_img = this._createImage();
function qualifyURL(url) {
var a = self._getDocument().createElement('a');
a.href = url;
return a.href;
}
this._icons[qualifyURL(img_names[i])] = null;
this._icons[this._qualifyURL(img_names[i])] = null;
if (typeof self._icons.itemsToLoad === 'undefined'){
this._icons.itemsToLoad = img_names.length;
}