fix touch zoom regression

This commit is contained in:
mourner 2012-02-25 00:05:06 +02:00
parent 4583eb13e0
commit 291f3515bf

View File

@ -16,8 +16,8 @@ L.Map.TouchZoom = L.Handler.extend({
if (!e.touches || e.touches.length !== 2 || map._animatingZoom || this._zooming) { return; } if (!e.touches || e.touches.length !== 2 || map._animatingZoom || this._zooming) { return; }
var p1 = map.mouseEventToContainerPoint(e.touches[0]), var p1 = map.mouseEventToLayerPoint(e.touches[0]),
p2 = map.mouseEventToContainerPoint(e.touches[1]), p2 = map.mouseEventToLayerPoint(e.touches[1]),
viewCenter = map.containerPointToLayerPoint(map.getSize().divideBy(2)); viewCenter = map.containerPointToLayerPoint(map.getSize().divideBy(2));
this._startCenter = p1.add(p2).divideBy(2, true); this._startCenter = p1.add(p2).divideBy(2, true);
@ -40,8 +40,8 @@ L.Map.TouchZoom = L.Handler.extend({
var map = this._map; var map = this._map;
var p1 = map.mouseEventToContainerPoint(e.touches[0]), var p1 = map.mouseEventToLayerPoint(e.touches[0]),
p2 = map.mouseEventToContainerPoint(e.touches[1]); p2 = map.mouseEventToLayerPoint(e.touches[1]);
this._scale = p1.distanceTo(p2) / this._startDist; this._scale = p1.distanceTo(p2) / this._startDist;
this._delta = p1.add(p2).divideBy(2, true).subtract(this._startCenter); this._delta = p1.add(p2).divideBy(2, true).subtract(this._startCenter);