fix markers in IE7 (you have to set the size explicitly for some reason)

This commit is contained in:
Mourner 2011-01-18 12:02:56 +02:00
parent 8137a92665
commit 2088223229

View File

@ -2,8 +2,8 @@ L.Icon = L.Class.extend({
iconUrl: L.ROOT_URL + 'images/marker.png',
shadowUrl: L.ROOT_URL + 'images/marker-shadow.png',
//iconSize: new L.Point(24, 37),
//shadowSize: new L.Point(42, 37),
iconSize: new L.Point(25, 41),
shadowSize: new L.Point(41, 41),
iconAnchor: new L.Point(13, 41),
popupAnchor: new L.Point(0, -33),
@ -23,9 +23,11 @@ L.Icon = L.Class.extend({
},
_createImg: function(name) {
var img = L.DomUtil.create('img', 'leaflet-marker-' + name);
var img = L.DomUtil.create('img', 'leaflet-marker-' + name),
size = this[name + 'Size'],
src = this[name + 'Url'];
img.src = this[name + 'Url'];
img.src = src;
if (this.iconAnchor) {
img.style.marginLeft = (-this.iconAnchor.x) + 'px';
@ -34,6 +36,11 @@ L.Icon = L.Class.extend({
L.DomEvent.addListener(img, 'load', this._setAnchorToCenter);
}
if (size) {
img.width = size.x;
img.height = size.y;
}
return img;
},