mirror of
https://github.com/Leaflet/Leaflet.git
synced 2025-08-16 16:45:22 +00:00
Add zIndex support to L.TileLayer
This commit is contained in:
3
dist/leaflet.css
vendored
3
dist/leaflet.css
vendored
@ -11,7 +11,8 @@
|
||||
.leaflet-popup-pane,
|
||||
.leaflet-overlay-pane svg,
|
||||
.leaflet-zoom-box,
|
||||
.leaflet-image-layer { /* TODO optimize classes */
|
||||
.leaflet-image-layer,
|
||||
.leaflet-layer { /* TODO optimize classes */
|
||||
position: absolute;
|
||||
}
|
||||
.leaflet-container {
|
||||
|
@ -12,6 +12,7 @@ L.TileLayer = L.Class.extend({
|
||||
subdomains: 'abc',
|
||||
errorTileUrl: '',
|
||||
attribution: '',
|
||||
zIndex: 0,
|
||||
opacity: 1,
|
||||
tms: false,
|
||||
continuousWorld: false,
|
||||
@ -124,6 +125,13 @@ L.TileLayer = L.Class.extend({
|
||||
return this;
|
||||
},
|
||||
|
||||
setZIndex: function (zIndex) {
|
||||
this.options.zIndex = zIndex;
|
||||
this._updateZIndex();
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
setUrl: function (url, noRedraw) {
|
||||
this._url = url;
|
||||
|
||||
@ -143,6 +151,12 @@ L.TileLayer = L.Class.extend({
|
||||
return this;
|
||||
},
|
||||
|
||||
_updateZIndex: function () {
|
||||
if (this._container) {
|
||||
this._container.style.zIndex = this.options.zIndex;
|
||||
}
|
||||
},
|
||||
|
||||
_updateOpacity: function () {
|
||||
L.DomUtil.setOpacity(this._container, this.options.opacity);
|
||||
|
||||
@ -166,6 +180,8 @@ L.TileLayer = L.Class.extend({
|
||||
if (!this._container || tilePane.empty) {
|
||||
this._container = L.DomUtil.create('div', 'leaflet-layer');
|
||||
|
||||
this._updateZIndex();
|
||||
|
||||
if (this._insertAtTheBottom && first) {
|
||||
tilePane.insertBefore(this._container, first);
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user