});
gWaitCounter++;
var trackLoadStarted = false;
+ var redrawBase = 100;
gTrackStore.getListStepped(function(aTPoint) {
if (aTPoint) {
// Add in front and return new length.
var tracklen = gTrack.unshift(aTPoint);
- // Redraw track every 100 values (initial paint will do first anyhow).
- if (tracklen % 100 == 0)
+ // Redraw track periodically, larger distance the longer it gets.
+ // Initial paint will do initial track drawing.
+ if (tracklen % redrawBase == 0) {
drawTrack();
+ redrawBase = tracklen;
+ }
}
else {
// Last point received.
handleEvent: function(aEvent) {
var touchEvent = aEvent.type.indexOf('touch') != -1;
+ if (touchEvent) {
+ aEvent.stopPropagation();
+ }
+
// Bail out if the event is happening on an input.
if (aEvent.target.tagName.toLowerCase() == "input")
return;
Math.pow(aEvent.targetTouches.item(1).clientY -
aEvent.targetTouches.item(0).clientY, 2)
);
- console.log(gPinchStartWidth + ' <?> ' + curPinchStartWidth);
+ if (!gPinchStartWidth)
+ gPinchStartWidth = curPinchStartWidth;
+
if (gPinchStartWidth / curPinchStartWidth > 1.7 ||
gPinchStartWidth / curPinchStartWidth < 0.6) {
var newZoomLevel = gPos.z + (gPinchStartWidth < curPinchStartWidth ? 1 : -1);
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;
break;
case "mouseup":
case "touchend":
+ gPinchStartWidth = null;
gDragging = false;
showUI();
break;