Editor: show CARPET sizes when Walls are on
Browse filesWith Walls on, room labels show carpet (inside-wall) size instead of built-up:
minus half an inner wall (0.2') on shared sides, a full outer wall (0.75') on
outside sides. Editor display only; scoring/generation untouched.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
floorplan_editor/frontend/index.html
CHANGED
|
@@ -341,6 +341,27 @@ function drawGap(g) {
|
|
| 341 |
ctx.restore();
|
| 342 |
}
|
| 343 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 344 |
function drawRoom(r, i) {
|
| 345 |
const cx=toCx(r.x), cy=toCy(r.y,r.h);
|
| 346 |
const cw=r.w*scale, ch=r.h*scale;
|
|
@@ -365,7 +386,9 @@ function drawRoom(r, i) {
|
|
| 365 |
// in the info bar at the top, so the boxes stay clean and legible.
|
| 366 |
const rawLabel = LABELS[r.name] || r.name.replace(/_/g," ");
|
| 367 |
const lines = rawLabel.split("\n");
|
| 368 |
-
|
|
|
|
|
|
|
| 369 |
const fsize = Math.max(7, Math.min(10, (ch-4)/(lines.length+0.5)));
|
| 370 |
// non-bold: bold was rendering blurry inside the coloured fills
|
| 371 |
ctx.font = `${fsize}px 'Segoe UI', sans-serif`;
|
|
@@ -743,6 +766,10 @@ document.getElementById("btn-reset").addEventListener("click", () => {
|
|
| 743 |
document.getElementById("btn-walls").addEventListener("click", (e) => {
|
| 744 |
showWalls = !showWalls;
|
| 745 |
e.target.textContent = showWalls ? "Walls: On" : "Walls: Off";
|
|
|
|
|
|
|
|
|
|
|
|
|
| 746 |
draw();
|
| 747 |
});
|
| 748 |
document.getElementById("fill-balcony").addEventListener("click", ()=>fillGapWith("balcony"));
|
|
|
|
| 341 |
ctx.restore();
|
| 342 |
}
|
| 343 |
|
| 344 |
+
// Carpet dimensions = built-up size minus the wall thickness that eats into
|
| 345 |
+
// this room on each side: half an INNER wall where the side is shared with
|
| 346 |
+
// another room, a full OUTER wall where the side faces outside. This is the
|
| 347 |
+
// usable area inside the walls, and is only meaningful with Walls turned on.
|
| 348 |
+
function carpetDims(r) {
|
| 349 |
+
const tol=0.6, minOv=1.0, ti=WALL_INNER, to=WALL_OUTER;
|
| 350 |
+
const hasNeigh = side => rooms.some(o => {
|
| 351 |
+
if (o===r) return false;
|
| 352 |
+
const yOv = Math.min(o.y+o.h, r.y+r.h) - Math.max(o.y, r.y) >= minOv;
|
| 353 |
+
const xOv = Math.min(o.x+o.w, r.x+r.w) - Math.max(o.x, r.x) >= minOv;
|
| 354 |
+
if (side==="L") return Math.abs(o.x+o.w-r.x)<tol && yOv;
|
| 355 |
+
if (side==="R") return Math.abs(r.x+r.w-o.x)<tol && yOv;
|
| 356 |
+
if (side==="B") return Math.abs(o.y+o.h-r.y)<tol && xOv;
|
| 357 |
+
if (side==="T") return Math.abs(r.y+r.h-o.y)<tol && xOv;
|
| 358 |
+
return false;
|
| 359 |
+
});
|
| 360 |
+
const a = side => (hasNeigh(side) ? ti/2 : to);
|
| 361 |
+
return { w: Math.max(0, r.w - a("L") - a("R")),
|
| 362 |
+
h: Math.max(0, r.h - a("B") - a("T")) };
|
| 363 |
+
}
|
| 364 |
+
|
| 365 |
function drawRoom(r, i) {
|
| 366 |
const cx=toCx(r.x), cy=toCy(r.y,r.h);
|
| 367 |
const cw=r.w*scale, ch=r.h*scale;
|
|
|
|
| 386 |
// in the info bar at the top, so the boxes stay clean and legible.
|
| 387 |
const rawLabel = LABELS[r.name] || r.name.replace(/_/g," ");
|
| 388 |
const lines = rawLabel.split("\n");
|
| 389 |
+
// with Walls on, show the CARPET size (inside the walls); otherwise built-up
|
| 390 |
+
const dim = showWalls ? carpetDims(r) : r;
|
| 391 |
+
lines.push(`${dim.w.toFixed(1)}' × ${dim.h.toFixed(1)}'`);
|
| 392 |
const fsize = Math.max(7, Math.min(10, (ch-4)/(lines.length+0.5)));
|
| 393 |
// non-bold: bold was rendering blurry inside the coloured fills
|
| 394 |
ctx.font = `${fsize}px 'Segoe UI', sans-serif`;
|
|
|
|
| 766 |
document.getElementById("btn-walls").addEventListener("click", (e) => {
|
| 767 |
showWalls = !showWalls;
|
| 768 |
e.target.textContent = showWalls ? "Walls: On" : "Walls: Off";
|
| 769 |
+
setStatus(showWalls
|
| 770 |
+
? "Walls on — room sizes now show CARPET area (inside the walls): "
|
| 771 |
+
+ "outer wall 0.75', shared walls 0.4' split half into each room."
|
| 772 |
+
: "Walls off — room sizes show built-up (wall-to-wall) dimensions.");
|
| 773 |
draw();
|
| 774 |
});
|
| 775 |
document.getElementById("fill-balcony").addEventListener("click", ()=>fillGapWith("balcony"));
|