leaflet-tile-loading-progress-control
Advanced tools
Comparing version 1.0.4 to 1.0.5
/* @preserve | ||
* Leaflet Control TileLoadingProgress 1.0.4 | ||
* Leaflet Control TileLoadingProgress 1.0.5 | ||
* https://github.com/jbccollins/leaflet-tile-loading-progress-control | ||
@@ -35,2 +35,4 @@ * | ||
onAdd: function (map) { | ||
var leafletElt = this.options.leafletElt; | ||
var controlInstance = this; | ||
var container = L.DomUtil.create('div', 'leaflet-control-progress-bar'); | ||
@@ -44,11 +46,14 @@ var loadingContainer = L.DomUtil.create('div', 'loading-container'); | ||
container.appendChild(loadingContainer); | ||
container.appendChild(loadingText); | ||
this.options.leafletElt.on('layeradd', function() { | ||
this.unbindLoadEventTriggers(); | ||
this.bindLoadEventTriggers(); | ||
container.appendChild(loadingText); | ||
leafletElt._map.on('layeradd', function(e) { | ||
var currentLayers = leafletElt.getLayers(); | ||
for (var i = 0; i < currentLayers.length; i++) { | ||
// If the layer added to the map is part of the layer group then we rebind the loading triggers. | ||
if (currentLayers[i] === e.layer) { | ||
controlInstance.unbindLoadEventTriggers(); | ||
controlInstance.bindLoadEventTriggers(); | ||
break; | ||
} | ||
} | ||
}); | ||
this.options.leafletElt.on('layerremove', function() { | ||
this.unbindLoadEventTriggers(); | ||
this.bindLoadEventTriggers(); | ||
}); | ||
this.bindLoadEventTriggers(); | ||
@@ -55,0 +60,0 @@ this.loadingForegroundElt = loadingForeground; |
{ | ||
"name": "leaflet-tile-loading-progress-control", | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"description": "A leaflet control that indicates tile loading progress for a group of tile layers", | ||
@@ -5,0 +5,0 @@ "main": "dist/Control.TileLoadingProgress.js", |
@@ -21,2 +21,4 @@ import L from 'leaflet'; | ||
onAdd: function (map) { | ||
var leafletElt = this.options.leafletElt; | ||
var controlInstance = this; | ||
var container = L.DomUtil.create('div', 'leaflet-control-progress-bar'); | ||
@@ -30,11 +32,14 @@ var loadingContainer = L.DomUtil.create('div', 'loading-container'); | ||
container.appendChild(loadingContainer); | ||
container.appendChild(loadingText); | ||
this.options.leafletElt.on('layeradd', function() { | ||
this.unbindLoadEventTriggers(); | ||
this.bindLoadEventTriggers(); | ||
container.appendChild(loadingText); | ||
leafletElt._map.on('layeradd', function(e) { | ||
var currentLayers = leafletElt.getLayers(); | ||
for (var i = 0; i < currentLayers.length; i++) { | ||
// If the layer added to the map is part of the layer group then we rebind the loading triggers. | ||
if (currentLayers[i] === e.layer) { | ||
controlInstance.unbindLoadEventTriggers(); | ||
controlInstance.bindLoadEventTriggers(); | ||
break; | ||
} | ||
} | ||
}); | ||
this.options.leafletElt.on('layerremove', function() { | ||
this.unbindLoadEventTriggers(); | ||
this.bindLoadEventTriggers(); | ||
}); | ||
this.bindLoadEventTriggers(); | ||
@@ -41,0 +46,0 @@ this.loadingForegroundElt = loadingForeground; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
123439
400