ebrelsford / Leaflet.loading

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

Can we set a time (half a second for example) before starting the loader? #29

Open damiendevienne opened 8 years ago

damiendevienne commented 8 years ago

Hello, this tool is really great, thanks! I have one simple question: Is there a way to ask the loader to wait before it is displayed? Because in my case, even when all tiles are already in the cache, the loader appears for a millisecond before disappearing when zooming or paning. It would be great that when the tiles appear almost instantaneously, the loader does not show up. Maybe a simple wait() or sleep() somewhere could do the trick?

Thanks a lot

ebrelsford commented 8 years ago

I'm open to pull requests for this kind of thing! Would be good to make it optional.

On Wed, Feb 3, 2016, 5:27 AM damiendevienne notifications@github.com wrote:

Hello, this tool is really great, thanks! I have one simple question: Is there a way to ask the loader to wait before it is displayed? Because in my case, even when all tiles are already in the cache, the loader appears for a millisecond before disappearing when zooming or paning It would be great that when the tiles appear almost instantaneously, the loader does not show up Maybe a simple wait() or sleep() somewhere could do the trick?

Thanks a lot

— Reply to this email directly or view it on GitHub https://github.com/ebrelsford/Leaflet.loading/issues/29.

ebrelsford commented 8 years ago

@damiendevienne mind checking out the latest version to see if that does what you expect?

damiendevienne commented 8 years ago

@ebrelsford I cannot make this option to work... It seems to have no effect whatever value I put for delayIndicator. I just wrote in my code: var loadingControl = L.Control.loading({delayIndicator: 500}).addTo(map); Any idea? Thanks

ebrelsford commented 8 years ago

Are you using the latest code from master? By "no effect" do you mean the loading indicator does not appear ever, or that there is no delay?

Here's an example of using it.

joshdickerson92 commented 8 years ago

@damiendevienne are you using Leaflet Version 1.0? The example is using 0.7.3 which works well. I've tried it with Leaflet version 1.0-dev and it appears that the indicator appears with no delay. @ebrelsford have you tested it with this version of leaflet?

ebrelsford commented 8 years ago

Yes I've tested it with Leaflet 1.0.0-rc1 and 1.0-dev with no issues. If you can post a full example of it not functioning that would help.