IE6 png24 markers and popup styling fixes

This commit is contained in:
Mourner 2011-02-28 16:39:51 +02:00
parent 773a13e68d
commit 0add3613a4
2 changed files with 25 additions and 18 deletions

4
dist/leaflet.ie.css vendored
View File

@ -1,9 +1,13 @@
.leaflet-popup-tip {
width: 21px;
_width: 27px;
margin: 0 auto;
_margin: -3px 0 auto;
filter: progid:DXImageTransform.Microsoft.Matrix(M11=0.70710678, M12=0.70710678, M21=-0.70710678, M22=0.70710678);
-ms-filter: "progid:DXImageTransform.Microsoft.Matrix(M11=0.70710678, M12=0.70710678, M21=-0.70710678, M22=0.70710678)";
}
.leaflet-popup-tip-container {
margin-top: -1px;
}

View File

@ -15,37 +15,40 @@ L.Icon = L.Class.extend({
},
createIcon: function() {
return this._createImg('icon');
return this._createIcon('icon');
},
createShadow: function() {
return this._createImg('shadow');
return this._createIcon('shadow');
},
_createImg: function(name) {
var img = L.DomUtil.create('img', 'leaflet-marker-' + name),
size = this[name + 'Size'],
src = this[name + 'Url'];
_createIcon: function(name) {
var size = this[name + 'Size'],
src = this[name + 'Url'],
img = this._createImg(src);
img.src = src;
img.className = 'leaflet-marker-' + name;
if (this.iconAnchor) {
img.style.marginLeft = (-this.iconAnchor.x) + 'px';
img.style.marginTop = (-this.iconAnchor.y) + 'px';
} else {
L.DomEvent.addListener(img, 'load', this._setAnchorToCenter);
}
if (size) {
img.width = size.x;
img.height = size.y;
img.style.width = size.x + 'px';
img.style.height = size.y + 'px';
}
return img;
},
_setAnchorToCenter: function() {
this.style.marginLeft = (-this.width/2) + 'px';
this.style.marginTop = (-this.height/2) + 'px';
_createImg: function(src) {
var el;
if (!L.Browser.ie6) {
el = document.createElement('img');
el.src = src;
} else {
el = document.createElement('div');
el.style.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src="' + src + '")';
}
return el;
}
});