Open arfa opened 8 years ago
Yes, this has been on my mind, the only issue is that this solution assumes that a load
event will be triggered at some point. That's impossible to ensure if we didn't detect loading
initially.
I'd be interested to see if there's a way to add the event listeners early enough to ensure that we get all the loading
events.
I got around this by checking if the _loading flag is set. Prob a bit hacky but fixed the issue for me. See https://github.com/benjeffery/Leaflet.loading/commit/339c1338753a9f5c7d8a074628da19093906eae3
If someone wanted to add this as an option and submit a PR I'd fold it in. I don't think we should rely on an internal member (_loading
) by default.
Hi, I think that the loader must be displayed by default. Later when the layer is loaded, the event
load
will trigger and the event handler will hide the loader.In fact the event
loading
is triggred before the method_addLayerListeners
is called. so the plugin dosn't handle the first time the map is loading.I suggest the following fix.
becomes
This way the loader appears when the map is loading for the first time.