From 33236d5e8922b3d1d1102eb29572dc1fccde1635 Mon Sep 17 00:00:00 2001 From: Mourner Date: Wed, 2 Mar 2011 19:48:34 +0200 Subject: [PATCH] mobile webkit svg flicker fix --- src/layer/vector/Path.VML.js | 4 ++++ src/layer/vector/Path.js | 11 +++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/layer/vector/Path.VML.js b/src/layer/vector/Path.VML.js index 7b974800..ab37281a 100644 --- a/src/layer/vector/Path.VML.js +++ b/src/layer/vector/Path.VML.js @@ -13,6 +13,10 @@ L.Path.VML = (function() { })(); L.Path = !L.Path.VML? L.Path : L.Path.extend({ + statics: { + CLIP_PADDING: 0.02 + }, + _createElement: (function() { document.createStyleSheet().addRule('.lvml', 'behavior:url(#default#VML); display: inline-block; position: absolute;'); try { diff --git a/src/layer/vector/Path.js b/src/layer/vector/Path.js index b0540f25..d078998e 100644 --- a/src/layer/vector/Path.js +++ b/src/layer/vector/Path.js @@ -85,12 +85,19 @@ L.Path = L.Class.extend({ max = vp.max, width = max.x - min.x, height = max.y - min.y, - root = this._map._pathRoot; + root = this._map._pathRoot, + pane = this._map._panes.overlayPane; + // Hack to make flicker on drag end on mobile webkit less irritating + // Unfortunately I haven't found a good workaround for this yet + if (L.Browser.mobileWebkit) { pane.removeChild(root); } + + L.DomUtil.setPosition(root, min); root.setAttribute('width', width); root.setAttribute('height', height); root.setAttribute('viewBox', [min.x, min.y, width, height].join(' ')); - L.DomUtil.setPosition(root, min); + + if (L.Browser.mobileWebkit) { pane.appendChild(root); } }, _updateViewport: function() {