don't hardcode sprite size

it can change any time the sprite is rebaked
This commit is contained in:
Ansis Brammanis
2013-03-20 17:09:25 -04:00
parent bd76219da7
commit 9a309c5009
+10 -3
View File
@@ -104,14 +104,21 @@ iD.svg.Surface = function() {
.attr('transform', function(d) { return "translate(" + d.x + "," + d.y + ")"; })
.attr('xlink:href', '#sprite');
defs.append('image')
var image = defs.append('image')
.attr({
id: 'maki-sprite',
width: 472,
height: 462,
'xlink:href': 'img/feature-icons.png'
});
var img = document.createElement('img');
img.src = 'img/feature-icons.png';
img.onload = function() {
image.attr({
width: img.width,
height: img.height
});
};
defs.selectAll()
.data(sprites("feature-icons.css", /^\.(feature-[a-z0-9-]+-(12|18))$/))
.enter().append('use')