mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-21 15:56:56 +02:00
don't hardcode sprite size
it can change any time the sprite is rebaked
This commit is contained in:
+10
-3
@@ -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')
|
||||
|
||||
Reference in New Issue
Block a user