stack transforms properly for tile layer anim, ref #1705

This commit is contained in:
Vladimir Agafonkin 2014-01-10 19:24:39 +02:00
parent b5569dd0c3
commit cd746192b5
2 changed files with 9 additions and 3 deletions

View File

@ -141,8 +141,11 @@ L.DomUtil = {
point.y + 'px' + (is3d ? ',0)' : ')'); point.y + 'px' + (is3d ? ',0)' : ')');
}, },
setTransform: function (el, point, scale) { setTransform: function (el, point, scale, oldTransform) {
el.style[L.DomUtil.TRANSFORM] = L.DomUtil.getTranslateString(point) + (scale ? ' scale(' + scale + ')' : ''); el.style[L.DomUtil.TRANSFORM] =
(oldTransform ? oldTransform + ' ' : '') +
L.DomUtil.getTranslateString(point) +
(scale ? ' scale(' + scale + ')' : '');
}, },
getScaleString: function (scale, origin) { getScaleString: function (scale, origin) {

View File

@ -465,14 +465,17 @@ L.GridLayer = L.Layer.extend({
}, },
_animateZoom: function (e) { _animateZoom: function (e) {
var oldTransform;
if (!this._animating) { if (!this._animating) {
this._animating = true; this._animating = true;
this._prepareBgBuffer(); this._prepareBgBuffer();
oldTransform = this._bgBuffer.style[L.DomUtil.TRANSFORM];
} }
var offset = e.delta.add(e.origin.multiplyBy(1 - e.scale)); 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 () { _endZoomAnim: function () {