Add version marker + wider canvas for X-swap labels

Add explicit X-swap marker comment so the user can verify they're
seeing the new build. Bump canvas width by 2*256 padding so the
X labels (drawn at canvasX + 244) are within the canvas even for
the rightmost drawn tile (east, perp=-2 -> canvasX 1152, label
at 1396). With wider canvas (1792 vs 1280), labels are visible
and the corridor is centred.
This commit is contained in:
Richard Zink committed 2026-10-08 09:47:04 +02:00
1 parent bac0397140
commit b5b169ae80
1 file changed
+3 -2
+3 -2
View File
@@ -337,7 +337,7 @@ function drawTileAt(lng, perp, dx, dz, centerTileX, centerTileY) {
// UNPACK_FLIP_Y_WEBGL=true inverts V: canvas top -> texture V=1 (top). // UNPACK_FLIP_Y_WEBGL=true inverts V: canvas top -> texture V=1 (top).
// For lng axis (Y): invert canvasY so lng=+12 (corridor front in // For lng axis (Y): invert canvasY so lng=+12 (corridor front in
// N flight) lands at small canvasY (= screen top after flip). // N flight) lands at small canvasY (= screen top after flip).
// For perp axis (X): keep the natural sign so world east (dx>0) // === X-SWAP BUILD v3 === // X-swap: east (perp=-2) -> canvasX 1152 (right)
// ends up at canvasX > halfPerp area (right side of canvas). // ends up at canvasX > halfPerp area (right side of canvas).
var canvasX = (-perp + halfPerp + 0.5) * GROUND_TILE_SIZE; var canvasX = (-perp + halfPerp + 0.5) * GROUND_TILE_SIZE;
var canvasY = (lng + halfLong + 0.5) * GROUND_TILE_SIZE; var canvasY = (lng + halfLong + 0.5) * GROUND_TILE_SIZE;
@@ -495,7 +495,8 @@ function initGroundSystem(glCtx) {
if (groundCanvas) return; // already initialised if (groundCanvas) return; // already initialised
groundGl = glCtx; groundGl = glCtx;
groundCanvas = document.createElement('canvas'); groundCanvas = document.createElement('canvas');
groundCanvas.width = GROUND_TILE_SIZE * GROUND_CORRIDOR_PERP; // Wider canvas so all X labels (at canvasX + 244) are visible
groundCanvas.width = GROUND_TILE_SIZE * GROUND_CORRIDOR_PERP + 2 * GROUND_TILE_SIZE;
groundCanvas.height = GROUND_TILE_SIZE * GROUND_CORRIDOR_LONG; groundCanvas.height = GROUND_TILE_SIZE * GROUND_CORRIDOR_LONG;
groundCtx = groundCanvas.getContext('2d'); groundCtx = groundCanvas.getContext('2d');
// Pre-fill with fog colour so partially-loaded mosaic still // Pre-fill with fog colour so partially-loaded mosaic still