added zoom animation
This commit is contained in:
parent
6885e69187
commit
f6a123667c
@ -104,24 +104,25 @@ L.CanvasLayer = L.Class.extend({
|
||||
// hide original
|
||||
this._canvas.style.display = 'none';
|
||||
back.style.display = 'block';
|
||||
var map = this._map;
|
||||
var scale = map.getZoomScale(e.zoom);
|
||||
var newCenter = map._latLngToNewLayerPoint(map.getCenter(), e.zoom, e.center);
|
||||
var oldCenter = map._latLngToNewLayerPoint(e.center, e.zoom, e.center);
|
||||
|
||||
var origin = {
|
||||
x: newCenter.x - oldCenter.x,
|
||||
y: newCenter.y - oldCenter.y
|
||||
};
|
||||
|
||||
var bg = back,
|
||||
transform = L.DomUtil.TRANSFORM,
|
||||
initialTransform = e.delta ? L.DomUtil.getTranslateString(e.delta) : bg.style[transform],
|
||||
scaleStr = L.DomUtil.getScaleString(e.scale, e.origin);
|
||||
|
||||
//scaleStr = ' scale(' + e.scale + ') ';
|
||||
bg.style[transform] = scaleStr;
|
||||
/*bg.style[transform] = e.backwards ?
|
||||
scaleStr + ' ' + initialTransform :
|
||||
initialTransform + ' ' + scaleStr;
|
||||
*/
|
||||
var bg = back;
|
||||
var transform = L.DomUtil.TRANSFORM;
|
||||
bg.style[transform] = L.DomUtil.getTranslateString(origin) + ' scale(' + e.scale + ') ';
|
||||
},
|
||||
|
||||
_endZoomAnim: function () {
|
||||
this._animating = false;
|
||||
//this._canvas.style.visibility = 'block';
|
||||
this._canvas.style.display = 'block';
|
||||
this._backCanvas.style.display = 'none';
|
||||
},
|
||||
|
||||
getCanvas: function() {
|
||||
|
Loading…
Reference in New Issue
Block a user