Norkart/Leaflet-MiniMap — pull request #13 by yohanboniface (2013-02-01 01:55:18+00:00)
Title: Fix occasional "this._aimingRect is undefined"

I was facing from time to time an error saying "this._aimingRect is undefined". Mainly when using a "Force reload" of the page (ctrl-R).

As suggested by a comment in the code, the problem was that the setView of the miniMap was made before its element was actually injected in the DOM.

In my point of view, a stronger approach is to rely on `L.Map.whenReady` to init event, and then set the miniMap view in an extended `addTo` method. With this I can't reproduce the bug.

Note that using `L.Map.whenReady` avoid using a Leaflet version lower than 0.5. This can be workarounded easily if you prefer not to add such a constraint to the plugin. Just tell me, and if needed I will remove `whenReady` and make it by hand ;)

What do you think of this? :)

Thanks!

Yohan