ebrelsford / Leaflet.loading

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

show spinner centered of the screen #25

Open hmarina opened 9 years ago

hmarina commented 9 years ago

I would like to show centered loading spinner position, is there way to show separate and centered of the screen. thank you.

ebrelsford commented 9 years ago

I don't see why not, have you tried changing the CSS to center it?

nenadvicentic commented 5 years ago

I just played with this (3 years later). It does not seem to be achievable without hacking into Leaflet.

Leaflet puts each element extending L.Control into one of four containers: topleft, topright, bottomleft and bottomright which is determined by optional position property of a L.Control. This containers are set to position: absolute and stitched to the egdes of leaflet-control-container. Only leaflet-control-container has css position set to "relative" and has same dimensions as full map.

In order to position LoadingControl to the center of a map, it needs to be placed directly into leaflet-control-container and not into child containers. This is currently not possible.

ebrelsford commented 5 years ago

Yes, the plugin would likely need to put the loading element somewhere outside of the typical Leaflet control elements if we wanted to do this.

I'm not convinced centering the spinner is a good idea design-wise and generally prefer to stick with the standard Leaflet controls configuration, so I'm not going to work on this. If someone wanted to work on a pull request I might consider merging it.