mobile webkit svg flicker fix

This commit is contained in:
Mourner 2011-03-02 19:48:34 +02:00
parent 6c960edf22
commit 33236d5e89
2 changed files with 13 additions and 2 deletions

View File

@ -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 {

View File

@ -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() {