var gDragging = false;
var gDragTouchID, gPinchStartWidth;
-var gGeoWatchID;
+var gGeoWatchID, gGPSWakeLock;
var gTrack = [];
var gLastTrackPoint, gLastDrawnPoint;
var gCenterPosition = true;
// Bail out if the started touch can't be found.
if (touchEvent && gDragging &&
- !aEvent.changedTouches.identifiedTouch(gDragTouchID))
+ !aEvent.targetTouches.item(0))
return;
}
var coordObj = touchEvent ?
- aEvent.changedTouches.identifiedTouch(gDragTouchID) :
+ aEvent.targetTouches.item(0) :
aEvent;
switch (aEvent.type) {
aEvent.targetTouches.item(0).clientY, 2)
);
}
- gDragTouchID = aEvent.changedTouches.item(0).identifier;
- coordObj = aEvent.changedTouches.identifiedTouch(gDragTouchID);
+ coordObj = aEvent.targetTouches.item(0);
}
var x = coordObj.clientX - gGLMapCanvas.offsetLeft;
var y = coordObj.clientY - gGLMapCanvas.offsetTop;
if (gGeolocation) {
gActionLabel.textContent = "Establishing Position";
gAction.style.display = "block";
+ if (navigator.requestWakeLock) {
+ gGPSWakeLock = navigator.requestWakeLock("gps");
+ }
gGeoWatchID = gGeolocation.watchPosition(
function(position) {
if (gActionLabel.textContent) {
gActionLabel.textContent = "";
gAction.style.display = "none";
}
+ if (navigator.requestWakeLock && gGPSWakeLock) {
+ console.log("releasing WakeLock");
+ gGPSWakeLock.unlock();
+ }
if (gGeoWatchID) {
gGeolocation.clearWatch(gGeoWatchID);
}