diff --git a/public/admin/plan.html b/public/admin/plan.html index dfa258a..c8c12ca 100644 --- a/public/admin/plan.html +++ b/public/admin/plan.html @@ -36,7 +36,7 @@ const PAPER = { A4: [210, 297], A3: [297, 420] }; const MARGIN = 10; // mm printable margin const OVERLAP = 10; // mm tile overlap for joining -const opts = { scale: '1', paper: 'A4', anchors: true, buildings: true, spawns: true, paths: true }; +const opts = { scale: '1', paper: 'A4', table: true, anchors: true, buildings: true, spawns: true, paths: true }; document.getElementById('controls').innerHTML = ` - ${['anchors','buildings','spawns','paths'].map(k => + ${['table','anchors','buildings','spawns','paths'].map(k => ``).join('')} `; ['scale','paper'].forEach(id => document.getElementById(id).onchange = e => { opts[id] = e.target.value; build(); }); -['anchors','buildings','spawns','paths'].forEach(k => +['table','anchors','buildings','spawns','paths'].forEach(k => document.getElementById('ly-' + k).onchange = e => { opts[k] = e.target.checked; build(); }); // ---------- geometry ---------- @@ -62,6 +62,8 @@ function extent() { minX = Math.min(minX, x - pad); maxX = Math.max(maxX, x + pad); minZ = Math.min(minZ, z - pad); maxZ = Math.max(maxZ, z + pad); }; + const t = scene.table; + if (t && t.show !== false) { eat(t.offsetX || 0, t.offsetZ || 0, 6); eat((t.offsetX || 0) + t.width, (t.offsetZ || 0) + t.depth, 6); } for (const a of scene.anchors || []) eat(a.position[0], a.position[2]); 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]); @@ -101,6 +103,19 @@ function planSVG(ex, k) { N (+Z, back) grid 10 cm`; + if (opts.table && scene.table && scene.table.show !== false) { + const t = scene.table; + const x0 = t.offsetX || 0, z0 = t.offsetZ || 0; + const tx = X(x0), ty = Y(z0 + t.depth), tw = t.width * S, th = t.depth * S; + g += ``; + // dimension labels with arrows: width along the front (bottom) edge, depth along the left edge + g += `← ${t.width} cm →`; + g += `← ${t.depth} cm →`; + g += `TABLE ${t.width} × ${t.depth} cm — back edge (N)`; + } + if (opts.paths) for (const p of scene.paths || []) { const pts = (p.points || []); if (pts.length < 2) continue;