Totally steal @javisantana's fix for IE TileLayer opacity ;)

This commit is contained in:
danzel 2013-02-15 10:33:54 +13:00
parent 513c6ca4cd
commit 4ffc982372
2 changed files with 17 additions and 3 deletions

View File

@ -7,6 +7,7 @@
var ie = !!window.ActiveXObject,
ie6 = ie && !window.XMLHttpRequest,
ie7 = ie && !document.querySelector,
ielt9 = ie && !document.addEventListener,
// terrible browser detection to work around Safari / iOS / Android browser bugs
ua = navigator.userAgent.toLowerCase(),
@ -63,6 +64,7 @@
ie: ie,
ie6: ie6,
ie7: ie7,
ielt9: ielt9,
webkit: webkit,
android: android,

View File

@ -186,12 +186,20 @@ L.TileLayer = L.Class.extend({
},
_updateOpacity: function () {
L.DomUtil.setOpacity(this._container, this.options.opacity);
// stupid webkit hack to force redrawing of tiles
var i,
tiles = this._tiles;
if (L.Browser.ielt9) {
for (i in tiles) {
if (tiles.hasOwnProperty(i)) {
L.DomUtil.setOpacity(tiles[i], this.options.opacity);
}
}
} else {
L.DomUtil.setOpacity(this._container, this.options.opacity);
}
// stupid webkit hack to force redrawing of tiles
if (L.Browser.webkit) {
for (i in tiles) {
if (tiles.hasOwnProperty(i)) {
@ -471,6 +479,10 @@ L.TileLayer = L.Class.extend({
_createTile: function () {
var tile = this._tileImg.cloneNode(false);
tile.onselectstart = tile.onmousemove = L.Util.falseFn;
if (L.Browser.ielt9 && this.options.opacity !== undefined) {
L.DomUtil.setOpacity(tile, this.options.opacity);
}
return tile;
},