From 22b46d0ab60fa53bf97024da8faa218e134ea820 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Stefanini?= Date: Thu, 2 Oct 2014 18:50:50 +0300 Subject: [PATCH 1/2] Updating initialization proccess. Put raphael paper in it's own div element to avoid conflict with other svg layers (such as those created by LeafletDraw) Update viewport on move event for smoother experience. --- src/layer/vector/Layer.Raphael.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/layer/vector/Layer.Raphael.js b/src/layer/vector/Layer.Raphael.js index fbbeacd..c29492f 100644 --- a/src/layer/vector/Layer.Raphael.js +++ b/src/layer/vector/Layer.Raphael.js @@ -50,10 +50,10 @@ R.Layer = L.Class.extend({ L.Map.include({ _initRaphaelRoot: function () { if (!this._raphaelRoot) { - this._raphaelRoot = this._panes.overlayPane; + this._raphaelRoot = document.createElement("div"); + this._panes.overlayPane.appendChild(this._raphaelRoot); this._paper = Raphael(this._raphaelRoot); - - this.on('moveend', this._updateRaphaelViewport); + this.on('move', this._updateRaphaelViewport); this._updateRaphaelViewport(); } }, @@ -79,4 +79,4 @@ L.Map.include({ this._paper.setViewBox(min.x, min.y, width, height, false); } -}); \ No newline at end of file +}); From 0bd092ac48fa3e91e222f4c0dbb3cbf64081746c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Stefanini?= Date: Thu, 2 Oct 2014 19:01:07 +0300 Subject: [PATCH 2/2] Include suggestion on Pull request #14 --- src/layer/vector/Layer.Raphael.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/layer/vector/Layer.Raphael.js b/src/layer/vector/Layer.Raphael.js index c29492f..3898757 100644 --- a/src/layer/vector/Layer.Raphael.js +++ b/src/layer/vector/Layer.Raphael.js @@ -51,7 +51,8 @@ L.Map.include({ _initRaphaelRoot: function () { if (!this._raphaelRoot) { this._raphaelRoot = document.createElement("div"); - this._panes.overlayPane.appendChild(this._raphaelRoot); + this._raphaelRoot.setAttribute("style","z-index:-1"); + this._panes.overlayPane.insertBefore(this._raphaelRoot, this._panes.overlayPane.firstChild); this._paper = Raphael(this._raphaelRoot); this.on('move', this._updateRaphaelViewport); this._updateRaphaelViewport();