* You can obtain one at http://mozilla.org/MPL/2.0/. */
var gMapCanvas, gMapContext, gTrackCanvas, gTrackContext, gGeolocation;
-var gDebug = true;
+var gDebug = false;
var gTileSize = 256;
var gMaxZoom = 18; // The minimum is 0.
var iyMin = gPos.y - ht / 2;
var ixoff = Math.round((aCoords.x * size - ixMin) / gZoomFactor);
var iyoff = Math.round((aCoords.y * size - iyMin) / gZoomFactor);
+ // Would be nice to draw directly from the blob, but that crashes:
+ // gMapContext.drawImage(aImage, ixoff, iyoff);
var URL = window.URL;
var imgURL = URL.createObjectURL(aImage);
var imgObj = new Image();
imgObj.src = imgURL;
- gMapContext.drawImage(imgObj, ixoff, iyoff);
- URL.revokeObjectURL(imgURL);
+ imgObj.onload = function() {
+ gMapContext.drawImage(imgObj, ixoff, iyoff);
+ URL.revokeObjectURL(imgURL);
+ }
}
});
}