From cd746192b594e1019ac5f298e31330c07f0a89f1 Mon Sep 17 00:00:00 2001 From: Vladimir Agafonkin Date: Fri, 10 Jan 2014 19:24:39 +0200 Subject: [PATCH] stack transforms properly for tile layer anim, ref #1705 --- src/dom/DomUtil.js | 7 +++++-- src/layer/tile/GridLayer.js | 5 ++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/dom/DomUtil.js b/src/dom/DomUtil.js index de6b91f2..a2530803 100644 --- a/src/dom/DomUtil.js +++ b/src/dom/DomUtil.js @@ -141,8 +141,11 @@ L.DomUtil = { point.y + 'px' + (is3d ? ',0)' : ')'); }, - setTransform: function (el, point, scale) { - el.style[L.DomUtil.TRANSFORM] = L.DomUtil.getTranslateString(point) + (scale ? ' scale(' + scale + ')' : ''); + setTransform: function (el, point, scale, oldTransform) { + el.style[L.DomUtil.TRANSFORM] = + (oldTransform ? oldTransform + ' ' : '') + + L.DomUtil.getTranslateString(point) + + (scale ? ' scale(' + scale + ')' : ''); }, getScaleString: function (scale, origin) { diff --git a/src/layer/tile/GridLayer.js b/src/layer/tile/GridLayer.js index d2759318..9be8bbb3 100644 --- a/src/layer/tile/GridLayer.js +++ b/src/layer/tile/GridLayer.js @@ -465,14 +465,17 @@ L.GridLayer = L.Layer.extend({ }, _animateZoom: function (e) { + var oldTransform; + if (!this._animating) { this._animating = true; this._prepareBgBuffer(); + oldTransform = this._bgBuffer.style[L.DomUtil.TRANSFORM]; } var offset = e.delta.add(e.origin.multiplyBy(1 - e.scale)); - L.DomUtil.setTransform(this._bgBuffer, offset, e.scale); + L.DomUtil.setTransform(this._bgBuffer, offset, e.scale, oldTransform); }, _endZoomAnim: function () {