pkaminski/sample — pull request #4 by pkaminski (2014-08-14 00:31:58+00:00)
Title: Pane management: huge refactoring and rewrite!

I've been messing with the master branch recently, eager to see the new Pane management features but was disappointed to see that you could not yet assign vector elements to custom Panes (#2779).

Well I started diving into the code to see what I could learn and improve and here are the results. I have completely rewritten the way that Panes work. Currently, Panes are simply DOM elements/containers, for example:

```

```

The problem is that, in the current state, Leaflet cannot put vector elements on any pane other than the overlayPane. The reason is that the map only uses a single Renderer, who's container would always show up on the overlayPane, even if you assigned a different or custom pane to a vector element as you created it. So therefore, all vector elements get added to the overlayPane since that is where the renderer's svg (or canvas or whatever) container was.

The solution is that Leaflet needed the ability to use multiple renderers, one for each pane that any vector elements existed on. Keeping track of multiple renders on panes being just DOM elements was tricky...