From 7a7d27b9b45b0d737c91435aace684d8d2bea8fa Mon Sep 17 00:00:00 2001 From: jessikitty Date: Mon, 3 Aug 2026 16:04:15 +1000 Subject: [PATCH] Fix plan scaling: extent tracks actual content/table instead of a fixed 100x100 floor --- public/admin/plan.html | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/public/admin/plan.html b/public/admin/plan.html index c8c12ca..fa02e37 100644 --- a/public/admin/plan.html +++ b/public/admin/plan.html @@ -57,7 +57,7 @@ document.getElementById('controls').innerHTML = ` // ---------- geometry ---------- function extent() { - let minX = 0, minZ = 0, maxX = 100, maxZ = 100; + let minX = Infinity, minZ = Infinity, maxX = -Infinity, maxZ = -Infinity; const eat = (x, z, pad = 10) => { minX = Math.min(minX, x - pad); maxX = Math.max(maxX, x + pad); minZ = Math.min(minZ, z - pad); maxZ = Math.max(maxZ, z + pad); @@ -68,6 +68,8 @@ function extent() { for (const b of scene.buildings || []) eat(b.position[0], b.position[2], Math.max(b.size[0], b.size[2]) / 2 + 5); for (const s of scene.spawns || []) eat(s.position[0], s.position[2]); for (const p of scene.paths || []) for (const q of p.points || []) eat(q[0], q[2]); + // nothing to draw → fall back to a small default page area + if (!isFinite(minX)) { minX = 0; minZ = 0; maxX = 100; maxZ = 100; } return { minX, minZ, maxX, maxZ, w: maxX - minX, h: maxZ - minZ }; }