X-Git-Url: https://git-public.kairo.at/?p=lantea.git;a=blobdiff_plain;f=js%2Fmap.js;h=dc3ad9c776637595ddbc764b18b111e119dc67ba;hp=2ecd3a4de86574dcf6e0cc1dc3d7a4e711ccbc4e;hb=d07d7abcbf226716c7f1d6cb70942252d5af27ad;hpb=517c0099ce72299ffb350423332a9fccf60a8ab3 diff --git a/js/map.js b/js/map.js index 2ecd3a4..dc3ad9c 100644 --- a/js/map.js +++ b/js/map.js @@ -512,6 +512,9 @@ var mapEvHandler = { Math.pow(aEvent.targetTouches.item(1).clientY - aEvent.targetTouches.item(0).clientY, 2) ); + if (!gPinchStartWidth) + gPinchStartWidth = curPinchStartWidth; + if (gPinchStartWidth / curPinchStartWidth > 1.7 || gPinchStartWidth / curPinchStartWidth < 0.6) { var newZoomLevel = gPos.z + (gPinchStartWidth < curPinchStartWidth ? 1 : -1); @@ -535,8 +538,12 @@ var mapEvHandler = { zoomIn(); else zoomOut(); + + // Reset pinch start width and start another pinch gesture. + gPinchStartWidth = null; } } + // If we are in a pinch, do not drag. break; } var x = coordObj.clientX - gMapCanvas.offsetLeft; @@ -567,6 +574,7 @@ var mapEvHandler = { break; case "mouseup": case "touchend": + gPinchStartWidth = null; gDragging = false; showUI(); break;