ebrelsford / Leaflet.loading

A simple loading control for Leaflet
MIT License
143 stars 49 forks source link

Showing indicator for all layers added to map #12

Closed alperdincer closed 10 years ago

alperdincer commented 10 years ago

I'm looking for a solution to show loading indicator for all types of maps including ImageOverlays or tiled layers over base maps.

Is there any trick to enable this plugin for all kinds of layers?

ebrelsford commented 10 years ago

@alperdincer no trick, it should work as long as each of your map's layers fire loading and load events to tell when the layer has started and stopped loading data. See the relevant piece of code. Give it a try and let me know how it works out?

alperdincer commented 10 years ago

Hi,

The WMS tiled layer is not working at the first load, but then it is working. Is it normal?

For the ImageOverlays, it is still not working, but I found that the problem is esri.leaflet library in my opinion. Because the "load" event is not firing even I listened the added layer individually. (https://github.com/Esri/esri-leaflet/blob/master/src/Layers/DynamicMapLayer.js)

I can't figure out how to enable the "load" and "loading" events in DynamicMapLayer.

alperdincer commented 10 years ago

I just find an issue in esri.leaflet plugin as follows:

https://github.com/Esri/esri-leaflet/issues/147

alperdincer commented 10 years ago

I solve the problem on ImageOverlays, but loading indicator is still not working on the first loading of layers.

Is this fixable?

Thanks for the great plugin.

ebrelsford commented 10 years ago

@alperdincer glad to hear you're making progress! Not sure why it wouldn't show on the first load, but off the top of my head it might have something to do with the layers being initialized before the loading control is. It would help if you could post the code (in a jsfiddle or similar).

ebrelsford commented 10 years ago

Closing this due to inactivity. @alperdincer, let me know if you have updates and feel free to reopen.