improve zoom perf by avoiding recompositing in grid layers

This commit is contained in:
Vladimir Agafonkin 2014-01-10 14:34:44 +02:00
parent 3b57b9a040
commit 30f86b11e3
2 changed files with 3 additions and 2 deletions

View File

@ -134,6 +134,7 @@ L.DomUtil = {
// on WebKit browsers, using translate3d instead of translate makes animation smoother
// as it ensures HW accel is used. Firefox doesn't care (same speed either way).
var is3d = L.Browser.webkit3d;
point = point || new L.Point(0, 0);
return 'translate' + (is3d ? '3d(' : '(') +
point.x + 'px,' +

View File

@ -498,7 +498,7 @@ L.GridLayer = L.Layer.extend({
if (map && !map._animatingZoom && !map.touchZoom._zooming) {
this._bgBuffer.innerHTML = '';
this._bgBuffer.style[L.DomUtil.TRANSFORM] = '';
this._bgBuffer.style[L.DomUtil.TRANSFORM] = L.DomUtil.getTranslateString();
}
},
@ -514,7 +514,7 @@ L.GridLayer = L.Layer.extend({
// prepare the buffer to become the front tile pane
bg.style.visibility = 'hidden';
bg.style[L.DomUtil.TRANSFORM] = '';
bg.style[L.DomUtil.TRANSFORM] = L.DomUtil.getTranslateString();
// switch out the current layer to be the new bg layer (and vice-versa)
this._tileContainer = bg;