Activate X-flip on image: negative width in drawImage

This commit is contained in:
Richard Zink committed 2026-10-08 10:26:09 +02:00
1 parent 0a770ba1be
commit f0641bd4bd
1 file changed
+6 -3
+6 -3
View File
@@ -350,9 +350,12 @@ function drawTileAt(lng, perp, dx, dz, centerTileX, centerTileY) {
// the corridor orientation (east tiles have their image east
// on the left of the drawn area, west tiles on the right).
// Labels are drawn separately in normal orientation, so the
// No X-flip on the image. Map content reads normally.
groundCtx.drawImage(img, canvasX, canvasY,
GROUND_TILE_SIZE, GROUND_TILE_SIZE);
// X-flip activated: draw with negative width to mirror
// horizontally. The image is anchored at the right edge
// (canvasX + TILE_SIZE) and extends leftward, producing a
// horizontally mirrored image.
groundCtx.drawImage(img, canvasX + GROUND_TILE_SIZE, canvasY,
-GROUND_TILE_SIZE, GROUND_TILE_SIZE);
groundLoadedTiles[tileX + '_' + tileY] = true;
// Thin border so the user can see where one tile ends and the