Activate X-flip on image: negative width in drawImage
This commit is contained in:
1 parent
0a770ba1be
commit
f0641bd4bd
1 file changed
+6
-3
Vendored
+6
-3
@@ -350,9 +350,12 @@ function drawTileAt(lng, perp, dx, dz, centerTileX, centerTileY) {
|
|||||||
// the corridor orientation (east tiles have their image east
|
// the corridor orientation (east tiles have their image east
|
||||||
// on the left of the drawn area, west tiles on the right).
|
// on the left of the drawn area, west tiles on the right).
|
||||||
// Labels are drawn separately in normal orientation, so the
|
// Labels are drawn separately in normal orientation, so the
|
||||||
// No X-flip on the image. Map content reads normally.
|
// X-flip activated: draw with negative width to mirror
|
||||||
groundCtx.drawImage(img, canvasX, canvasY,
|
// horizontally. The image is anchored at the right edge
|
||||||
GROUND_TILE_SIZE, GROUND_TILE_SIZE);
|
// (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;
|
groundLoadedTiles[tileX + '_' + tileY] = true;
|
||||||
|
|
||||||
// Thin border so the user can see where one tile ends and the
|
// Thin border so the user can see where one tile ends and the
|
||||||
|
|||||||
Reference in new issue
Block a user