forked from Snck3rs/contao-leaflet-maps
Fix omnivore loading control integration
This commit is contained in:
@@ -115,24 +115,22 @@ L.Contao = L.Class.extend({
|
|||||||
* @param map Pass a map object so that the data loading events are passed to the map.
|
* @param map Pass a map object so that the data loading events are passed to the map.
|
||||||
*/
|
*/
|
||||||
loadLayer: function(url, type, options, customLayer, map) {
|
loadLayer: function(url, type, options, customLayer, map) {
|
||||||
if (map) {
|
|
||||||
map.fire('dataloading');
|
|
||||||
}
|
|
||||||
|
|
||||||
var layer = omnivore[type](url, options, customLayer);
|
var layer = omnivore[type](url, options, customLayer);
|
||||||
|
|
||||||
layer.on('ready', function(e) {
|
// Required because Control.Loading tries to get _leafet_id which is created here.
|
||||||
if (map) {
|
L.stamp(layer);
|
||||||
map.fire('dataload');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
layer.on('error', function(e) {
|
if (map) {
|
||||||
if (map) {
|
map.fire('dataloading', { layer: layer });
|
||||||
map.fire('dataload');
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
layer.on('ready', function() {
|
||||||
|
map.fire('dataload', { layer: layer });
|
||||||
|
});
|
||||||
|
|
||||||
|
layer.on('error', function() {
|
||||||
|
map.fire('dataload', { layer: layer });
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
return layer;
|
return layer;
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user