X-Git-Url: https://git-public.kairo.at/?p=lantea.git;a=blobdiff_plain;f=js%2Fmap.js;h=04bbc1a1c6e9598fe3d09d7f55f8f07e54ea1ede;hp=ea3b62256c5d54ce23511f004445afc600ef0c73;hb=a2131f638052d88255a2696986d5a40f90482df1;hpb=a8634d376327635d475798e7cfbc5b3630935f18 diff --git a/js/map.js b/js/map.js index ea3b622..04bbc1a 100644 --- a/js/map.js +++ b/js/map.js @@ -3,7 +3,7 @@ * 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. @@ -297,12 +297,16 @@ function drawMap() { 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); + } } }); }