ebrelsford / Leaflet.loading

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

Enable separated control element #2

Closed nickiaconis closed 11 years ago

nickiaconis commented 11 years ago

Adds the option to create the loading control disconnected from the zoom control. This enables greater freedom in styling the indicator, including 22px sq. working area (as opposed to 16px sq. when attached to the zoom control) and no default border. The attached indicator is still available as the default option.

ebrelsford commented 11 years ago

@codefox421 Thanks for the pull requests. I'm on the road, but I'm going to pull them down as soon as I get a chance and will get back to you.

ebrelsford commented 11 years ago

@codefox421 Thanks again, this looks basically good, but I don't think I can accept it until it's clear how you would use it.

If loadingControl: true is not in the map's options, then the event handlers are not added to the map, so the control doesn't work. But when loadingControl: true is in the map's options, the control is loaded with no options.

So as it stands it looks like the only way to use the separate option is to hack addInitHook, and that's definitely not satisfactory! Are you using it some other way that I'm not foreseeing?

ebrelsford commented 11 years ago

Oops, just realized that's in #3. I'll check that out soon and get back to you.

nickiaconis commented 11 years ago

Yeah, I probably opened #2 and #3 in the wrong order. Sorry for the confusion. I'm incorporating this control into a project based around Leaflet, and that just happened to be the order in which I realized my need for those features.