should reduce #32 impact a lot

This commit is contained in:
Mourner 2011-04-13 14:52:09 +03:00
parent 47ada8f7f2
commit 8c970cc190

View File

@ -16,7 +16,7 @@ L.Handler.TouchZoom = L.Handler.extend({
}, },
_onTouchStart: function(e) { _onTouchStart: function(e) {
if (!e.touches || e.touches.length != 2 || this._animatingZoom) { return; } if (!e.touches || e.touches.length != 2 || this._map._animatingZoom) { return; }
var p1 = this._map.mouseEventToLayerPoint(e.touches[0]), var p1 = this._map.mouseEventToLayerPoint(e.touches[0]),
p2 = this._map.mouseEventToLayerPoint(e.touches[1]), p2 = this._map.mouseEventToLayerPoint(e.touches[1]),
@ -65,10 +65,7 @@ L.Handler.TouchZoom = L.Handler.extend({
}, },
_onTouchEnd: function(e) { _onTouchEnd: function(e) {
if (!e.touches || e.touches.length >= 2 || !this._moved) { return; } if (!this._moved || !this._zooming) { return; }
// prevent touchEnd from firing twice
if (!this._zooming) { return; }
this._zooming = false; this._zooming = false;
var oldZoom = this._map.getZoom(), var oldZoom = this._map.getZoom(),