diff --git a/vendor/clouds3d.js b/vendor/clouds3d.js index d524183..ec6ae60 100644 --- a/vendor/clouds3d.js +++ b/vendor/clouds3d.js @@ -339,7 +339,13 @@ function drawTileAt(lng, perp, dx, dz, centerTileX, centerTileY) { return Promise.resolve(false); } return fetchTileImage(tileX, tileY).then(function(img) { - groundCtx.drawImage(img, canvasX, canvasY); + // Rotate image 180 degrees: draw with negative width and + // negative height, anchored at the tile's bottom-right corner + // (canvasX + 256, canvasY + 256). After this, image north + // (high lat) is at canvas bottom and image south at canvas + // top; image east at canvas right, image west at canvas left. + groundCtx.drawImage(img, canvasX + GROUND_TILE_SIZE, canvasY + GROUND_TILE_SIZE, + -GROUND_TILE_SIZE, -GROUND_TILE_SIZE); groundLoadedTiles[tileX + '_' + tileY] = true; // Debug labels: 'N' at the image's north edge (top of canvas