makes image object instead of passing just the name

This commit is contained in:
Francisco Dans 2014-12-30 10:53:46 +01:00
parent 3cdd89ab24
commit ead86bad00

View File

@ -72,7 +72,9 @@
} }
function renderSprite(ctx, st) { function renderSprite(ctx, st) {
var img = st['point-file'] || st['marker-file']; var img_name = st['point-file'] || st['marker-file'];
var img = new Image();
img.src = img_name;
var ratio = img.height/img.width; var ratio = img.height/img.width;
var w = st['marker-width'] || img.width; var w = st['marker-width'] || img.width;
var h = st['marker-width'] || st['marker-height'] || w*ratio; var h = st['marker-width'] || st['marker-height'] || w*ratio;