From dcf3b0f4c72776777150ef68eaa219defc24e8b5 Mon Sep 17 00:00:00 2001 From: pvinton Date: Mon, 21 Oct 2013 17:53:42 -0500 Subject: [PATCH] Update Layer.Raphael.js Added a new div under overlayPane for raphaelRoot. This allows raphael objects to "play nicely" with other non-Raphael SVG and VML objects that are also plotted on the map at the same time. Without this extra div, non-Raphael objects have some erratic behavior: they sometimes disappear and/or are offset incorrectly, especially after panning and zooming. --- src/layer/vector/Layer.Raphael.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/layer/vector/Layer.Raphael.js b/src/layer/vector/Layer.Raphael.js index fbbeacd..42ef25b 100644 --- a/src/layer/vector/Layer.Raphael.js +++ b/src/layer/vector/Layer.Raphael.js @@ -50,7 +50,11 @@ R.Layer = L.Class.extend({ L.Map.include({ _initRaphaelRoot: function () { if (!this._raphaelRoot) { - this._raphaelRoot = this._panes.overlayPane; + overlayPane = this._panes.overlayPane; + var raphaelDiv = document.createElement("div"); + raphaelDiv.setAttribute("style","z-index:-1;"); + overlayPane.appendChild(raphaelDiv); + this._raphaelRoot = raphaelDiv; this._paper = Raphael(this._raphaelRoot); this.on('moveend', this._updateRaphaelViewport); @@ -79,4 +83,4 @@ L.Map.include({ this._paper.setViewBox(min.x, min.y, width, height, false); } -}); \ No newline at end of file +});