add a comment about crashing with drawing a blob
authorRobert Kaiser <kairo@kairo.at>
Fri, 14 Dec 2012 13:02:09 +0000 (14:02 +0100)
committerRobert Kaiser <kairo@kairo.at>
Fri, 14 Dec 2012 13:02:09 +0000 (14:02 +0100)
js/map.js

index bb2d6bb..04bbc1a 100644 (file)
--- a/js/map.js
+++ b/js/map.js
@@ -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);
+          }
         }
       });
     }