Fix misleading comment: image is X-flipped (NS-mirror), not 180°
The drawImage call uses width=-TILE, height=+TILE, which is an X-only horizontal mirror. The old comment said '180 degrees' which implied both axes flipped; the code is only horizontal. NS axis = vertical axis, mirror across it = horizontal mirror. Current state matches the user's observation: tile content is NS-mirrored, X arrangement goes low->high left to right.
This commit is contained in:
1 parent
4500fe3214
commit
2128220b39
1 file changed
+6
-9
Vendored
+6
-9
@@ -345,15 +345,12 @@ function drawTileAt(lng, perp, dx, dz, centerTileX, centerTileY) {
|
|||||||
return Promise.resolve(false);
|
return Promise.resolve(false);
|
||||||
}
|
}
|
||||||
return fetchTileImage(tileX, tileY).then(function(img) {
|
return fetchTileImage(tileX, tileY).then(function(img) {
|
||||||
// Rotate image 180 degrees: draw with negative width and
|
// Mirror image across the NS axis (horizontal / X-flip):
|
||||||
// negative height, anchored at the tile's bottom-right corner
|
// draw with negative width and positive height, anchored at
|
||||||
// (canvasX + 256, canvasY + 256). After this, image north
|
// the tile's right edge (canvasX + 256). Image top (north)
|
||||||
// (high lat) is at canvas bottom and image south at canvas
|
// stays at canvas top, image bottom (south) at canvas bottom.
|
||||||
// top; image east at canvas right, image west at canvas left.
|
// Image left (west) -> canvas right, image right (east) ->
|
||||||
// Mirror image across the NS axis (X-only flip). Image top
|
// canvas left.
|
||||||
// (north) stays at canvas top, image bottom (south) stays
|
|
||||||
// at canvas bottom. Image left (west) -> canvas right, image
|
|
||||||
// right (east) -> canvas left.
|
|
||||||
groundCtx.drawImage(img, canvasX + GROUND_TILE_SIZE, canvasY,
|
groundCtx.drawImage(img, canvasX + GROUND_TILE_SIZE, canvasY,
|
||||||
-GROUND_TILE_SIZE, GROUND_TILE_SIZE);
|
-GROUND_TILE_SIZE, GROUND_TILE_SIZE);
|
||||||
groundLoadedTiles[tileX + '_' + tileY] = true;
|
groundLoadedTiles[tileX + '_' + tileY] = true;
|
||||||
|
|||||||
Reference in new issue
Block a user