Light theme, larger type, zoning count fix, doors on utility and common bath
Browse filesInterface converted to light (theme set in .streamlit/config.toml as well as
CSS so Streamlit's own widgets follow), with larger type throughout and the
editor canvas converted to match. Functional Zoning under-counted because
pooja_room and walk_in_closet had no band and were silently dropped - both are
now banded, so every room is judged. Doors are generated on the utility and
common washroom; only the passage stays without one. Connectivity graph and the
edited-plan comparison reduced in size.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- .streamlit/config.toml +16 -0
- app.py +103 -66
- core/metrics.py +8 -2
- floorplan_editor/frontend/index.html +89 -82
.streamlit/config.toml
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Light theme. Set here rather than only in CSS because Streamlit's own
|
| 2 |
+
# widgets β dataframes, expanders, inputs, the sidebar β read the theme from
|
| 3 |
+
# config; CSS alone leaves their internals dark.
|
| 4 |
+
[theme]
|
| 5 |
+
base = "light"
|
| 6 |
+
primaryColor = "#1F4E79"
|
| 7 |
+
backgroundColor = "#FFFFFF"
|
| 8 |
+
secondaryBackgroundColor = "#F1F5F9"
|
| 9 |
+
textColor = "#14213D"
|
| 10 |
+
font = "sans serif"
|
| 11 |
+
|
| 12 |
+
[server]
|
| 13 |
+
headless = true
|
| 14 |
+
|
| 15 |
+
[browser]
|
| 16 |
+
gatherUsageStats = false
|
app.py
CHANGED
|
@@ -43,72 +43,100 @@ if st.session_state.get("app_layout_version") != APP_LAYOUT_VERSION:
|
|
| 43 |
st.markdown(
|
| 44 |
"""
|
| 45 |
<style>
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 50 |
.main-header {
|
| 51 |
background: #0a2a54;
|
| 52 |
-
padding: 1.
|
| 53 |
border-radius: 12px;
|
| 54 |
-
margin-bottom: 1.
|
| 55 |
text-align: center;
|
| 56 |
-
box-shadow: 0 4px 20px rgba(0,0,0,0.35);
|
| 57 |
}
|
| 58 |
-
.main-header h1 { color: #
|
| 59 |
-
|
|
|
|
|
|
|
| 60 |
.section-header {
|
| 61 |
-
border-left:
|
| 62 |
-
padding-left: 0.
|
| 63 |
-
margin: 1.
|
| 64 |
-
font-size: 1.
|
| 65 |
letter-spacing: 0.2px;
|
| 66 |
}
|
| 67 |
-
|
|
|
|
| 68 |
div[data-testid="stMetric"] {
|
| 69 |
-
background:
|
| 70 |
-
border-radius: 12px; padding: 0.
|
| 71 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 72 |
}
|
| 73 |
-
|
| 74 |
/* Plan gallery tiles */
|
| 75 |
.plan-tile img {
|
| 76 |
-
border-radius: 10px; border: 1px solid
|
| 77 |
background: #fff; transition: all 0.15s ease;
|
| 78 |
}
|
| 79 |
-
.plan-tile-sel img { border: 2px solid
|
|
|
|
|
|
|
| 80 |
.room-list {
|
| 81 |
-
background:
|
| 82 |
-
border:
|
| 83 |
-
|
| 84 |
-
padding: 0.65rem 0.85rem;
|
| 85 |
-
font-size: 0.82rem;
|
| 86 |
-
line-height: 1.45;
|
| 87 |
-
}
|
| 88 |
-
/* Primary action buttons */
|
| 89 |
-
.stButton>button {
|
| 90 |
-
border-radius: 9px; font-weight: 600;
|
| 91 |
-
transition: all 0.15s ease;
|
| 92 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 93 |
.stButton>button[kind="primary"] {
|
| 94 |
-
background: linear-gradient(135deg,
|
| 95 |
-
border: none; color:
|
| 96 |
}
|
| 97 |
-
.stButton>button[kind="primary"]:hover { transform: translateY(-1px);
|
| 98 |
.stButton>button[kind="secondary"] {
|
| 99 |
-
background: #
|
| 100 |
}
|
| 101 |
-
.stButton>button[kind="secondary"]:hover { border-color:
|
| 102 |
-
|
| 103 |
-
|
|
|
|
|
|
|
| 104 |
section[data-testid="stSidebar"] {
|
| 105 |
-
background: #
|
| 106 |
position: sticky !important; top: 0 !important;
|
| 107 |
align-self: flex-start; height: 100vh !important;
|
| 108 |
}
|
| 109 |
-
section[data-testid="stSidebar"] > div:first-child {
|
| 110 |
-
|
| 111 |
-
}
|
| 112 |
div[data-testid="stSidebarUserContent"] { min-height: 100%; padding-bottom: 1rem; }
|
| 113 |
</style>
|
| 114 |
""",
|
|
@@ -134,26 +162,27 @@ def render_side_scores(raw_fp, opt_fp, road_side, selected_vastu=None):
|
|
| 134 |
co = plan_metrics.evaluate(opt_fp, road_side, selected_vastu)
|
| 135 |
|
| 136 |
def row(lab, val, dv, big=False):
|
| 137 |
-
col = "#
|
| 138 |
-
sz = "
|
| 139 |
wt = "700" if big else "500"
|
| 140 |
return (
|
| 141 |
f'<div style="display:flex;justify-content:space-between;'
|
| 142 |
-
f'align-items:baseline;padding:
|
| 143 |
-
f'<span style="font-size:{sz};color:#
|
| 144 |
-
f'<span style="font-size:{sz};font-weight:{wt};color:#
|
| 145 |
-
f'{val * 100:.0f}%<span style="color:{col};font-size:
|
| 146 |
-
f'margin-left:
|
| 147 |
-
|
| 148 |
-
html = ['<div style="background:#
|
| 149 |
-
'border-radius:10px;padding:
|
| 150 |
-
'<div style="font-size:
|
| 151 |
-
'text-transform:uppercase;margin-bottom:
|
|
|
|
| 152 |
row("Fitness", co.fitness, co.fitness - cr.fitness, big=True)]
|
| 153 |
for key, lab in plan_metrics.METRIC_LABELS:
|
| 154 |
html.append(row(lab, co.scores[key],
|
| 155 |
co.scores[key] - cr.scores[key]))
|
| 156 |
-
html.append('<div style="font-size:
|
| 157 |
'green/red = change vs the AI-generated plan</div></div>')
|
| 158 |
st.markdown("".join(html), unsafe_allow_html=True)
|
| 159 |
|
|
@@ -169,15 +198,16 @@ def render_side_legend(fp):
|
|
| 169 |
seen.add(r.name)
|
| 170 |
col = _ROOM_COLORS.get(r.name, "#607D8B")
|
| 171 |
html.append(
|
| 172 |
-
'<div style="display:flex;align-items:center;gap:
|
| 173 |
-
'padding:
|
| 174 |
-
'font-size:
|
| 175 |
-
f'<span style="width:
|
| 176 |
-
f'background:{col};flex:0 0
|
|
|
|
| 177 |
f'<span>{pretty_room(r.name)}</span></div>')
|
| 178 |
st.markdown(
|
| 179 |
-
'<div style="font-size:
|
| 180 |
-
'color:#
|
| 181 |
+ "".join(html), unsafe_allow_html=True)
|
| 182 |
|
| 183 |
|
|
@@ -344,7 +374,7 @@ def fig_connectivity_graph(nodes, edges, blocked_edges=()):
|
|
| 344 |
rooms that physically touch but may not be used as a route (e.g. two
|
| 345 |
bedrooms), which is what usually explains a stranded room."""
|
| 346 |
import matplotlib.pyplot as plt
|
| 347 |
-
fig, ax = plt.subplots(figsize=(
|
| 348 |
for i, j in blocked_edges:
|
| 349 |
ax.plot([nodes[i][1], nodes[j][1]], [nodes[i][2], nodes[j][2]],
|
| 350 |
":", color="#E53935", lw=1.0, alpha=0.75, zorder=1)
|
|
@@ -731,7 +761,11 @@ def render_evaluation(raw_fp, opt_fp, road_side, selected_vastu=None):
|
|
| 731 |
for n, ib, dist, nm, ab, ok in zd["rows"]]),
|
| 732 |
hide_index=True, width="stretch")
|
| 733 |
st.markdown(f"**Final = {zd['satisfied']} satisfied Γ· "
|
| 734 |
-
f"{zd['total']} rooms = {_pct(s['zoning'])}**"
|
|
|
|
|
|
|
|
|
|
|
|
|
| 735 |
|
| 736 |
with _tabs[8]:
|
| 737 |
st.markdown(f"**Connectivity β {_pct(s['connectivity'])}**")
|
|
@@ -765,7 +799,7 @@ def render_evaluation(raw_fp, opt_fp, road_side, selected_vastu=None):
|
|
| 765 |
if cn.get("nodes"):
|
| 766 |
fig_cg = fig_connectivity_graph(cn["nodes"], cn["edges"],
|
| 767 |
cn.get("blocked_edges", ()))
|
| 768 |
-
gcol, _gpad = st.columns([1, 1])
|
| 769 |
gcol.pyplot(fig_cg)
|
| 770 |
import matplotlib.pyplot as _plt
|
| 771 |
_plt.close(fig_cg)
|
|
@@ -1347,7 +1381,10 @@ if top_plans:
|
|
| 1347 |
road_side, "Your Edited Plan")
|
| 1348 |
ed_png = fig_to_bytes(ed_fig).getvalue()
|
| 1349 |
_plt_ed.close(ed_fig)
|
| 1350 |
-
|
|
|
|
|
|
|
|
|
|
| 1351 |
pv1.image(o_png, width="stretch")
|
| 1352 |
pv2.image(ed_png, width="stretch")
|
| 1353 |
|
|
|
|
| 43 |
st.markdown(
|
| 44 |
"""
|
| 45 |
<style>
|
| 46 |
+
/* ββ Light theme βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 47 |
+
White surfaces, ink-dark text. Nothing lighter than #5A6B80 is used for
|
| 48 |
+
text, so every label stays readable on white. Base sizes are a step up
|
| 49 |
+
from Streamlit's defaults for legibility on a projector. */
|
| 50 |
+
:root {
|
| 51 |
+
--bg: #FFFFFF; --card: #F7FAFC; --line: #D8E1EA;
|
| 52 |
+
--accent: #1F4E79; --accent-2: #2E75B6;
|
| 53 |
+
--ink: #14213D; --ink-2: #41546B; --ink-3: #5A6B80;
|
| 54 |
+
}
|
| 55 |
+
html, body, .stApp { background: var(--bg); color: var(--ink); }
|
| 56 |
+
.stApp, .stMarkdown, p, li, span, label, div[data-testid="stMarkdownContainer"] {
|
| 57 |
+
font-size: 1.02rem; color: var(--ink);
|
| 58 |
+
}
|
| 59 |
+
.block-container { padding-top: 2.0rem; max-width: 1560px; }
|
| 60 |
+
|
| 61 |
.main-header {
|
| 62 |
background: #0a2a54;
|
| 63 |
+
padding: 1.7rem 2rem;
|
| 64 |
border-radius: 12px;
|
| 65 |
+
margin-bottom: 1.5rem;
|
| 66 |
text-align: center;
|
|
|
|
| 67 |
}
|
| 68 |
+
.main-header h1 { color: #FFFFFF; font-size: 2.15rem; margin: 0;
|
| 69 |
+
letter-spacing: 0.3px; font-weight: 800; }
|
| 70 |
+
.main-header p { color: #DCE8F5; font-size: 1.0rem; margin: 0.4rem 0 0 0; }
|
| 71 |
+
|
| 72 |
.section-header {
|
| 73 |
+
border-left: 5px solid var(--accent-2);
|
| 74 |
+
padding-left: 0.85rem;
|
| 75 |
+
margin: 1.8rem 0 0.8rem 0;
|
| 76 |
+
font-size: 1.35rem; font-weight: 700; color: var(--accent);
|
| 77 |
letter-spacing: 0.2px;
|
| 78 |
}
|
| 79 |
+
|
| 80 |
+
/* Metric tiles as clean white cards */
|
| 81 |
div[data-testid="stMetric"] {
|
| 82 |
+
background: var(--card); border: 1px solid var(--line);
|
| 83 |
+
border-radius: 12px; padding: 0.85rem 1rem;
|
| 84 |
+
}
|
| 85 |
+
div[data-testid="stMetricLabel"] p { font-size: 0.95rem; color: var(--ink-2); }
|
| 86 |
+
div[data-testid="stMetricValue"] { font-size: 1.6rem; font-weight: 700;
|
| 87 |
+
color: var(--ink); }
|
| 88 |
+
|
| 89 |
+
/* Tables */
|
| 90 |
+
div[data-testid="stDataFrame"] { font-size: 1.0rem; }
|
| 91 |
+
div[data-testid="stDataFrame"] * { color: var(--ink); }
|
| 92 |
+
|
| 93 |
+
/* Expanders / tabs */
|
| 94 |
+
div[data-testid="stExpander"] summary p { font-size: 1.05rem; font-weight: 600;
|
| 95 |
+
color: var(--accent); }
|
| 96 |
+
button[data-baseweb="tab"] p { font-size: 0.98rem; }
|
| 97 |
+
|
| 98 |
+
/* Captions must stay readable β Streamlit's default grey is too light */
|
| 99 |
+
div[data-testid="stCaptionContainer"], div[data-testid="stCaptionContainer"] p {
|
| 100 |
+
color: var(--ink-3) !important; font-size: 0.92rem;
|
| 101 |
}
|
| 102 |
+
|
| 103 |
/* Plan gallery tiles */
|
| 104 |
.plan-tile img {
|
| 105 |
+
border-radius: 10px; border: 1px solid var(--line);
|
| 106 |
background: #fff; transition: all 0.15s ease;
|
| 107 |
}
|
| 108 |
+
.plan-tile-sel img { border: 2px solid var(--accent-2);
|
| 109 |
+
box-shadow: 0 0 0 3px rgba(46,117,182,0.18); }
|
| 110 |
+
|
| 111 |
.room-list {
|
| 112 |
+
background: var(--card); border: 1px solid var(--line);
|
| 113 |
+
border-radius: 8px; padding: 0.7rem 0.9rem;
|
| 114 |
+
font-size: 0.95rem; line-height: 1.5;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 115 |
}
|
| 116 |
+
|
| 117 |
+
/* Buttons */
|
| 118 |
+
.stButton>button { border-radius: 9px; font-weight: 600; font-size: 1.0rem;
|
| 119 |
+
transition: all 0.15s ease; }
|
| 120 |
.stButton>button[kind="primary"] {
|
| 121 |
+
background: linear-gradient(135deg, var(--accent), var(--accent-2));
|
| 122 |
+
border: none; color: #FFFFFF;
|
| 123 |
}
|
| 124 |
+
.stButton>button[kind="primary"]:hover { transform: translateY(-1px); }
|
| 125 |
.stButton>button[kind="secondary"] {
|
| 126 |
+
background: #FFFFFF; border: 1px solid var(--line); color: var(--ink-2);
|
| 127 |
}
|
| 128 |
+
.stButton>button[kind="secondary"]:hover { border-color: var(--accent-2);
|
| 129 |
+
color: var(--accent); }
|
| 130 |
+
|
| 131 |
+
/* Sidebar: light, and pinned so the room key stays visible while the
|
| 132 |
+
gallery scrolls. */
|
| 133 |
section[data-testid="stSidebar"] {
|
| 134 |
+
background: #F4F8FC; border-right: 1px solid var(--line);
|
| 135 |
position: sticky !important; top: 0 !important;
|
| 136 |
align-self: flex-start; height: 100vh !important;
|
| 137 |
}
|
| 138 |
+
section[data-testid="stSidebar"] > div:first-child { height: 100%; overflow-y: auto; }
|
| 139 |
+
section[data-testid="stSidebar"] * { color: var(--ink); }
|
|
|
|
| 140 |
div[data-testid="stSidebarUserContent"] { min-height: 100%; padding-bottom: 1rem; }
|
| 141 |
</style>
|
| 142 |
""",
|
|
|
|
| 162 |
co = plan_metrics.evaluate(opt_fp, road_side, selected_vastu)
|
| 163 |
|
| 164 |
def row(lab, val, dv, big=False):
|
| 165 |
+
col = "#1B7F3B" if dv > 0.05 else ("#C0392B" if dv < -0.05 else "#5A6B80")
|
| 166 |
+
sz = "15px" if big else "13px"
|
| 167 |
wt = "700" if big else "500"
|
| 168 |
return (
|
| 169 |
f'<div style="display:flex;justify-content:space-between;'
|
| 170 |
+
f'align-items:baseline;padding:5px 0;border-bottom:1px solid #E3EAF2">'
|
| 171 |
+
f'<span style="font-size:{sz};color:#41546B">{lab}</span>'
|
| 172 |
+
f'<span style="font-size:{sz};font-weight:{wt};color:#14213D">'
|
| 173 |
+
f'{val * 100:.0f}%<span style="color:{col};font-size:11.5px;'
|
| 174 |
+
f'margin-left:6px">{dv * 100:+.0f}</span></span></div>')
|
| 175 |
+
|
| 176 |
+
html = ['<div style="background:#F7FAFC;border:1px solid #D8E1EA;'
|
| 177 |
+
'border-radius:10px;padding:11px 13px">',
|
| 178 |
+
'<div style="font-size:12px;letter-spacing:.4px;color:#1F4E79;'
|
| 179 |
+
'text-transform:uppercase;font-weight:700;margin-bottom:6px">'
|
| 180 |
+
'Score</div>',
|
| 181 |
row("Fitness", co.fitness, co.fitness - cr.fitness, big=True)]
|
| 182 |
for key, lab in plan_metrics.METRIC_LABELS:
|
| 183 |
html.append(row(lab, co.scores[key],
|
| 184 |
co.scores[key] - cr.scores[key]))
|
| 185 |
+
html.append('<div style="font-size:11px;color:#5A6B80;margin-top:7px">'
|
| 186 |
'green/red = change vs the AI-generated plan</div></div>')
|
| 187 |
st.markdown("".join(html), unsafe_allow_html=True)
|
| 188 |
|
|
|
|
| 198 |
seen.add(r.name)
|
| 199 |
col = _ROOM_COLORS.get(r.name, "#607D8B")
|
| 200 |
html.append(
|
| 201 |
+
'<div style="display:flex;align-items:center;gap:11px;'
|
| 202 |
+
'padding:8px 2px;border-bottom:1px solid #E3EAF2;'
|
| 203 |
+
'font-size:15px;color:#14213D">'
|
| 204 |
+
f'<span style="width:17px;height:17px;border-radius:4px;'
|
| 205 |
+
f'background:{col};flex:0 0 17px;'
|
| 206 |
+
f'border:1px solid rgba(0,0,0,.15)"></span>'
|
| 207 |
f'<span>{pretty_room(r.name)}</span></div>')
|
| 208 |
st.markdown(
|
| 209 |
+
'<div style="font-size:13px;letter-spacing:.6px;text-transform:uppercase;'
|
| 210 |
+
'color:#1F4E79;font-weight:700;margin:2px 0 6px">Rooms</div>'
|
| 211 |
+ "".join(html), unsafe_allow_html=True)
|
| 212 |
|
| 213 |
|
|
|
|
| 374 |
rooms that physically touch but may not be used as a route (e.g. two
|
| 375 |
bedrooms), which is what usually explains a stranded room."""
|
| 376 |
import matplotlib.pyplot as plt
|
| 377 |
+
fig, ax = plt.subplots(figsize=(3.6, 3.1), dpi=110)
|
| 378 |
for i, j in blocked_edges:
|
| 379 |
ax.plot([nodes[i][1], nodes[j][1]], [nodes[i][2], nodes[j][2]],
|
| 380 |
":", color="#E53935", lw=1.0, alpha=0.75, zorder=1)
|
|
|
|
| 761 |
for n, ib, dist, nm, ab, ok in zd["rows"]]),
|
| 762 |
hide_index=True, width="stretch")
|
| 763 |
st.markdown(f"**Final = {zd['satisfied']} satisfied Γ· "
|
| 764 |
+
f"{zd['total']} rooms = {_pct(s['zoning'])}** \n"
|
| 765 |
+
f"*The staircase is not in the count β it is the entry "
|
| 766 |
+
f"every distance is measured FROM, so its own distance "
|
| 767 |
+
f"from itself is meaningless. Every other room in the "
|
| 768 |
+
f"plan is judged.*")
|
| 769 |
|
| 770 |
with _tabs[8]:
|
| 771 |
st.markdown(f"**Connectivity β {_pct(s['connectivity'])}**")
|
|
|
|
| 799 |
if cn.get("nodes"):
|
| 800 |
fig_cg = fig_connectivity_graph(cn["nodes"], cn["edges"],
|
| 801 |
cn.get("blocked_edges", ()))
|
| 802 |
+
gcol, _gpad = st.columns([1, 1.6]) # keep the graph small
|
| 803 |
gcol.pyplot(fig_cg)
|
| 804 |
import matplotlib.pyplot as _plt
|
| 805 |
_plt.close(fig_cg)
|
|
|
|
| 1381 |
road_side, "Your Edited Plan")
|
| 1382 |
ed_png = fig_to_bytes(ed_fig).getvalue()
|
| 1383 |
_plt_ed.close(ed_fig)
|
| 1384 |
+
# Kept to two thirds of the row so the pair reads at a comfortable size
|
| 1385 |
+
# rather than filling the page β these are a comparison, not the
|
| 1386 |
+
# working drawing.
|
| 1387 |
+
pv1, pv2, _pv_pad = st.columns([1, 1, 1])
|
| 1388 |
pv1.image(o_png, width="stretch")
|
| 1389 |
pv2.image(ed_png, width="stretch")
|
| 1390 |
|
core/metrics.py
CHANGED
|
@@ -141,13 +141,19 @@ DEFAULT_WEIGHTS: Dict[str, float] = {
|
|
| 141 |
|
| 142 |
# ββ Sheet "Finalised Adjacency" (zoning block): functional zones βββββββββββββ
|
| 143 |
PUBLIC = {"living_room", "external_staircase", "balcony", "study",
|
| 144 |
-
"kitchen", "utility_area", "foyer", "lift"
|
|
|
|
|
|
|
|
|
|
|
|
|
| 145 |
# Washrooms are PRIVATE, both kinds β an attached bath obviously so, and a
|
| 146 |
# common bath is still a private space rather than a transitional one.
|
| 147 |
TRANSITION = {"dining_room", "internal_corridor"}
|
| 148 |
PRIVATE = {"master_bedroom", "bedroom_01", "bedroom_02", "bedroom_03",
|
| 149 |
"attached_bathroom", "attached_bathroom_02", "powder_room",
|
| 150 |
-
"common_bathroom"
|
|
|
|
|
|
|
| 151 |
_ZONE_RANK = {}
|
| 152 |
for _n in PUBLIC:
|
| 153 |
_ZONE_RANK[_n] = 0
|
|
|
|
| 141 |
|
| 142 |
# ββ Sheet "Finalised Adjacency" (zoning block): functional zones βββββββββββββ
|
| 143 |
PUBLIC = {"living_room", "external_staircase", "balcony", "study",
|
| 144 |
+
"kitchen", "utility_area", "foyer", "lift",
|
| 145 |
+
# pooja is entered from the living / dining / kitchen side, so it
|
| 146 |
+
# belongs to the common band. Without it here the room was silently
|
| 147 |
+
# dropped from the zoning table and the denominator under-counted.
|
| 148 |
+
"pooja_room"}
|
| 149 |
# Washrooms are PRIVATE, both kinds β an attached bath obviously so, and a
|
| 150 |
# common bath is still a private space rather than a transitional one.
|
| 151 |
TRANSITION = {"dining_room", "internal_corridor"}
|
| 152 |
PRIVATE = {"master_bedroom", "bedroom_01", "bedroom_02", "bedroom_03",
|
| 153 |
"attached_bathroom", "attached_bathroom_02", "powder_room",
|
| 154 |
+
"common_bathroom",
|
| 155 |
+
# a walk-in closet opens off a bedroom, so it is as private as one
|
| 156 |
+
"walk_in_closet"}
|
| 157 |
_ZONE_RANK = {}
|
| 158 |
for _n in PUBLIC:
|
| 159 |
_ZONE_RANK[_n] = 0
|
floorplan_editor/frontend/index.html
CHANGED
|
@@ -3,108 +3,114 @@
|
|
| 3 |
<head>
|
| 4 |
<meta charset="UTF-8">
|
| 5 |
<style>
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
* { box-sizing: border-box; margin: 0; padding: 0; }
|
| 7 |
body {
|
| 8 |
-
background: #
|
| 9 |
font-family: 'Segoe UI', Arial, sans-serif;
|
| 10 |
-
color: #
|
| 11 |
padding: 6px;
|
| 12 |
}
|
| 13 |
#toolbar {
|
| 14 |
display: flex; align-items: center; gap: 8px;
|
| 15 |
-
padding:
|
| 16 |
-
border: 1px solid #
|
| 17 |
-
margin-bottom:
|
| 18 |
}
|
| 19 |
-
#status { flex: 1; font-size:
|
| 20 |
.btn {
|
| 21 |
-
background: #
|
| 22 |
-
border: 1px solid #
|
| 23 |
-
padding:
|
| 24 |
}
|
| 25 |
-
.btn:hover:not(:disabled) { background: #
|
| 26 |
-
.btn:disabled { opacity: 0.
|
| 27 |
-
.btn-danger { border-color: #
|
| 28 |
-
.btn-danger:hover:not(:disabled) { background: #
|
| 29 |
-
.btn-primary { background: #1F4E79; border-color: #
|
| 30 |
.btn-primary:hover:not(:disabled) { background: #2E75B6; }
|
| 31 |
-
.btn-fill { border-color: #
|
| 32 |
-
.btn-fill:hover:not(:disabled) { background: #
|
| 33 |
-
#canvas { display: block; border: 1px solid #
|
| 34 |
-
|
| 35 |
-
#
|
|
|
|
| 36 |
#gap-bar {
|
| 37 |
display: none; align-items: center; gap: 8px; flex-wrap: wrap;
|
| 38 |
-
padding:
|
| 39 |
-
background: #
|
| 40 |
-
color: #
|
| 41 |
}
|
| 42 |
#open-bar {
|
| 43 |
-
flex-direction: column; align-items: stretch; gap:
|
| 44 |
-
padding:
|
| 45 |
-
background: #
|
| 46 |
-
color: #
|
| 47 |
}
|
| 48 |
-
#open-presets { display: flex; flex-wrap: wrap; gap:
|
| 49 |
-
.btn-size { border-color: #
|
| 50 |
-
.btn-size:hover:not(:disabled) { background: #
|
| 51 |
-
.btn-size.on { background: #
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
#
|
| 56 |
-
|
| 57 |
-
#side-panel { flex: 1 1
|
| 58 |
-
display: flex; flex-direction: column; gap:
|
| 59 |
-
/* The room key is a full-height reference panel, not a cramped list. */
|
| 60 |
#left-panel > .panel-card { flex: 1 1 auto; display: flex; flex-direction: column;
|
| 61 |
min-height: 0; }
|
| 62 |
#side-panel > .panel-card { flex: 0 0 auto; }
|
| 63 |
#side-panel > .panel-card.grow { flex: 1 1 auto; }
|
| 64 |
-
.panel-card { background: #
|
| 65 |
-
padding:
|
| 66 |
-
.panel-card h4 { margin: 0 0
|
| 67 |
-
text-transform: uppercase; color: #
|
| 68 |
-
.card-red { border-color: #
|
| 69 |
-
.card-red h4 { color: #
|
| 70 |
-
.card-blue { border-color: #
|
| 71 |
-
.card-blue h4 { color: #
|
| 72 |
-
.card-pink { border-color: #
|
| 73 |
-
.card-pink h4 { color: #
|
| 74 |
-
.toggle-col { display: flex; flex-direction: column; gap:
|
| 75 |
.toggle-col .btn { width: 100%; text-align: left; }
|
| 76 |
-
#lock-list { margin: 0; padding-left:
|
| 77 |
-
color: #
|
| 78 |
-
#lock-list li { margin:
|
| 79 |
-
#lock-list .u { color: #
|
| 80 |
-
#lock-rooms { margin-top:
|
| 81 |
-
.lock-head { font-size:
|
| 82 |
-
.lock-row { display: flex; justify-content: space-between; gap:
|
| 83 |
-
font-size:
|
| 84 |
-
border-bottom: 1px solid #
|
| 85 |
-
.lock-name { color: #
|
| 86 |
-
.lock-why { color: #
|
| 87 |
-
.lock-foot { font-size:
|
| 88 |
-
.lock-none { font-size:
|
| 89 |
-
.btn-apply-big { width: 100%; margin-top:
|
| 90 |
-
font-size:
|
| 91 |
-
#sizes-card { font-size:
|
| 92 |
-
#sizes-card .big { font-size:
|
| 93 |
#sizes-card .row { display: flex; justify-content: space-between;
|
| 94 |
-
border-bottom: 1px solid #
|
| 95 |
-
#sizes-card .presets { color: #
|
| 96 |
#legend { flex: 1 1 auto; display: flex; flex-direction: column;
|
| 97 |
-
justify-content: space-evenly; padding: 0; font-size:
|
| 98 |
-
.leg { display: flex; align-items: center; gap:
|
| 99 |
-
padding:
|
|
|
|
| 100 |
@media (max-width: 760px) { #stage { flex-direction: column; }
|
| 101 |
#left-panel, #side-panel { max-width: none;
|
| 102 |
width: 100%; }
|
| 103 |
#legend { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
|
| 104 |
gap: 0 12px; }
|
| 105 |
-
.leg { min-height:
|
| 106 |
}
|
| 107 |
-
.leg-dot { width:
|
|
|
|
| 108 |
</style>
|
| 109 |
</head>
|
| 110 |
<body>
|
|
@@ -368,7 +374,7 @@ function draw() {
|
|
| 368 |
}
|
| 369 |
|
| 370 |
// Axis labels
|
| 371 |
-
ctx.fillStyle="#
|
| 372 |
ctx.textAlign="center"; ctx.textBaseline="top";
|
| 373 |
ctx.fillText(`${plotW} ft`, PAD.l+pw/2, PAD.t+ph+5);
|
| 374 |
ctx.save(); ctx.translate(12, PAD.t+ph/2); ctx.rotate(-Math.PI/2);
|
|
@@ -511,10 +517,11 @@ function openingGeom(o) {
|
|
| 511 |
|
| 512 |
// One door on each room's legitimate access wall, one window on each exterior
|
| 513 |
// wall β added only if that room/side has no opening yet, so user edits stick.
|
| 514 |
-
//
|
| 515 |
-
//
|
| 516 |
-
//
|
| 517 |
-
|
|
|
|
| 518 |
const NO_WINDOW = ["balcony"];
|
| 519 |
|
| 520 |
function seedOpenings() {
|
|
@@ -683,7 +690,7 @@ function drawGap(g) {
|
|
| 683 |
ctx.strokeStyle="#2EA043"; ctx.lineWidth=2; ctx.setLineDash([6,4]);
|
| 684 |
ctx.strokeRect(cx,cy,cw,ch);
|
| 685 |
ctx.setLineDash([]);
|
| 686 |
-
ctx.fillStyle="#
|
| 687 |
ctx.textAlign="center"; ctx.textBaseline="middle";
|
| 688 |
if (cw>28 && ch>14) ctx.fillText("empty", cx+cw/2, cy+ch/2);
|
| 689 |
ctx.restore();
|
|
@@ -759,7 +766,7 @@ function drawHandles(r, handles) {
|
|
| 759 |
}
|
| 760 |
|
| 761 |
function drawRoadLabel(pw, ph) {
|
| 762 |
-
ctx.fillStyle="#
|
| 763 |
ctx.textAlign="center"; ctx.textBaseline="middle";
|
| 764 |
const arrows={S:"βΌ ROAD",N:"β² ROAD",E:"βΆ ROAD",W:"β ROAD"};
|
| 765 |
const lbl = arrows[roadSide]||"ROAD";
|
|
@@ -846,7 +853,7 @@ function drawLockedLinks() {
|
|
| 846 |
if (!lockedPairs.length) return;
|
| 847 |
const rMap=Object.fromEntries(rooms.map(r=>[r.name,r]));
|
| 848 |
const ftY=fy=>PAD.t+(plotH-fy)*scale;
|
| 849 |
-
ctx.strokeStyle="#
|
| 850 |
for (const [a,b] of lockedPairs) {
|
| 851 |
const ra=rMap[a], rb=rMap[b];
|
| 852 |
if (!ra||!rb) continue;
|
|
@@ -1310,7 +1317,7 @@ function buildSizesCard() {
|
|
| 1310 |
+ `<div class="presets">presets: ${WINDOW_PRESETS.map(p=>p.toFixed(1)+"'").join(" Β· ")}</div>`
|
| 1311 |
+ `<div class="presets" style="margin-top:7px;line-height:1.5">`
|
| 1312 |
+ `Select a door/window to change its size or delete it.<br>`
|
| 1313 |
-
+ `No door on passage
|
| 1314 |
+ `</div>`;
|
| 1315 |
}
|
| 1316 |
|
|
|
|
| 3 |
<head>
|
| 4 |
<meta charset="UTF-8">
|
| 5 |
<style>
|
| 6 |
+
/* ββ Light theme, larger type ββββββββββββββββββββββββββββββββββββββββββ
|
| 7 |
+
White surfaces with ink-dark text, matching the host application. Every
|
| 8 |
+
size is a step up from the previous dark build so the panels stay
|
| 9 |
+
readable beside the drawing. */
|
| 10 |
* { box-sizing: border-box; margin: 0; padding: 0; }
|
| 11 |
body {
|
| 12 |
+
background: #FFFFFF;
|
| 13 |
font-family: 'Segoe UI', Arial, sans-serif;
|
| 14 |
+
color: #14213D;
|
| 15 |
padding: 6px;
|
| 16 |
}
|
| 17 |
#toolbar {
|
| 18 |
display: flex; align-items: center; gap: 8px;
|
| 19 |
+
padding: 8px 12px; background: #F4F8FC;
|
| 20 |
+
border: 1px solid #D8E1EA; border-radius: 8px;
|
| 21 |
+
margin-bottom: 8px; flex-wrap: wrap;
|
| 22 |
}
|
| 23 |
+
#status { flex: 1; font-size: 13px; color: #41546B; min-width: 180px; }
|
| 24 |
.btn {
|
| 25 |
+
background: #FFFFFF; color: #14213D;
|
| 26 |
+
border: 1px solid #C7D4E1; border-radius: 6px;
|
| 27 |
+
padding: 6px 14px; font-size: 13px; cursor: pointer; white-space: nowrap;
|
| 28 |
}
|
| 29 |
+
.btn:hover:not(:disabled) { background: #EDF3F9; border-color: #2E75B6; }
|
| 30 |
+
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
|
| 31 |
+
.btn-danger { border-color: #E0A6A2; color: #B0322B; }
|
| 32 |
+
.btn-danger:hover:not(:disabled) { background: #FDECEA; }
|
| 33 |
+
.btn-primary { background: #1F4E79; border-color: #1F4E79; color: #fff; }
|
| 34 |
.btn-primary:hover:not(:disabled) { background: #2E75B6; }
|
| 35 |
+
.btn-fill { border-color: #8CC79E; color: #17703A; }
|
| 36 |
+
.btn-fill:hover:not(:disabled) { background: #EAF7EE; }
|
| 37 |
+
#canvas { display: block; border: 1px solid #D8E1EA; border-radius: 6px;
|
| 38 |
+
background: #FFFFFF; cursor: default; }
|
| 39 |
+
#info-bar { font-size: 12.5px; color: #1F4E79; padding: 4px 2px 0; min-height: 18px; }
|
| 40 |
+
#val-bar { font-size: 12.5px; color: #41546B; padding: 4px 2px 0; min-height: 16px; }
|
| 41 |
#gap-bar {
|
| 42 |
display: none; align-items: center; gap: 8px; flex-wrap: wrap;
|
| 43 |
+
padding: 8px 12px; margin-top: 8px; font-size: 13px;
|
| 44 |
+
background: #EAF7EE; border: 1px solid #8CC79E; border-radius: 8px;
|
| 45 |
+
color: #17703A;
|
| 46 |
}
|
| 47 |
#open-bar {
|
| 48 |
+
flex-direction: column; align-items: stretch; gap: 7px;
|
| 49 |
+
padding: 9px 10px; margin-top: 9px; font-size: 12.5px;
|
| 50 |
+
background: #FFF8E6; border: 1px solid #D9A400; border-radius: 8px;
|
| 51 |
+
color: #6B4E00;
|
| 52 |
}
|
| 53 |
+
#open-presets { display: flex; flex-wrap: wrap; gap: 5px; }
|
| 54 |
+
.btn-size { border-color: #D9A400; color: #6B4E00; padding: 4px 10px; }
|
| 55 |
+
.btn-size:hover:not(:disabled) { background: #FFF1CC; }
|
| 56 |
+
.btn-size.on { background: #D9A400; color: #FFFFFF; font-weight: bold; }
|
| 57 |
+
|
| 58 |
+
/* The room key sits on the LEFT of the drawing; the controls on the right.
|
| 59 |
+
Both columns stretch to the plan's height. */
|
| 60 |
+
#stage { display: flex; align-items: stretch; gap: 14px; }
|
| 61 |
+
#left-panel { flex: 0 0 210px; display: flex; flex-direction: column; gap: 11px; }
|
| 62 |
+
#side-panel { flex: 1 1 240px; min-width: 225px; max-width: 330px;
|
| 63 |
+
display: flex; flex-direction: column; gap: 11px; }
|
|
|
|
| 64 |
#left-panel > .panel-card { flex: 1 1 auto; display: flex; flex-direction: column;
|
| 65 |
min-height: 0; }
|
| 66 |
#side-panel > .panel-card { flex: 0 0 auto; }
|
| 67 |
#side-panel > .panel-card.grow { flex: 1 1 auto; }
|
| 68 |
+
.panel-card { background: #F7FAFC; border: 1px solid #D8E1EA; border-radius: 9px;
|
| 69 |
+
padding: 11px 13px; overflow: auto; }
|
| 70 |
+
.panel-card h4 { margin: 0 0 9px; font-size: 13px; letter-spacing: .4px;
|
| 71 |
+
text-transform: uppercase; color: #1F4E79; font-weight: 700; }
|
| 72 |
+
.card-red { border-color: #E0A6A2; }
|
| 73 |
+
.card-red h4 { color: #B0322B; }
|
| 74 |
+
.card-blue { border-color: #A9C6E4; }
|
| 75 |
+
.card-blue h4 { color: #1F4E79; }
|
| 76 |
+
.card-pink { border-color: #E3AFC8; }
|
| 77 |
+
.card-pink h4 { color: #A03A6B; }
|
| 78 |
+
.toggle-col { display: flex; flex-direction: column; gap: 6px; }
|
| 79 |
.toggle-col .btn { width: 100%; text-align: left; }
|
| 80 |
+
#lock-list { margin: 0; padding-left: 17px; font-size: 12.5px;
|
| 81 |
+
color: #14213D; line-height: 1.55; }
|
| 82 |
+
#lock-list li { margin: 4px 0; }
|
| 83 |
+
#lock-list .u { color: #17703A; font-weight: 600; }
|
| 84 |
+
#lock-rooms { margin-top: 10px; border-top: 1px solid #D8E1EA; padding-top: 8px; }
|
| 85 |
+
.lock-head { font-size: 12px; color: #8A6100; font-weight: 700; margin-bottom: 6px; }
|
| 86 |
+
.lock-row { display: flex; justify-content: space-between; gap: 8px;
|
| 87 |
+
font-size: 12px; padding: 4px 0;
|
| 88 |
+
border-bottom: 1px solid #E3EAF2; }
|
| 89 |
+
.lock-name { color: #14213D; white-space: nowrap; font-weight: 600; }
|
| 90 |
+
.lock-why { color: #5A6B80; text-align: right; }
|
| 91 |
+
.lock-foot { font-size: 11.5px; color: #5A6B80; margin-top: 7px; }
|
| 92 |
+
.lock-none { font-size: 12.5px; color: #17703A; }
|
| 93 |
+
.btn-apply-big { width: 100%; margin-top: 11px; padding: 11px 12px;
|
| 94 |
+
font-size: 15px; font-weight: 700; }
|
| 95 |
+
#sizes-card { font-size: 12.5px; color: #14213D; line-height: 1.65; }
|
| 96 |
+
#sizes-card .big { font-size: 17px; font-weight: 700; color: #8A6100; }
|
| 97 |
#sizes-card .row { display: flex; justify-content: space-between;
|
| 98 |
+
border-bottom: 1px solid #E3EAF2; padding: 4px 0; }
|
| 99 |
+
#sizes-card .presets { color: #5A6B80; margin-top: 5px; }
|
| 100 |
#legend { flex: 1 1 auto; display: flex; flex-direction: column;
|
| 101 |
+
justify-content: space-evenly; padding: 0; font-size: 14px; }
|
| 102 |
+
.leg { display: flex; align-items: center; gap: 9px; min-height: 30px;
|
| 103 |
+
padding: 5px 1px; border-bottom: 1px solid #E3EAF2;
|
| 104 |
+
color: #14213D; }
|
| 105 |
@media (max-width: 760px) { #stage { flex-direction: column; }
|
| 106 |
#left-panel, #side-panel { max-width: none;
|
| 107 |
width: 100%; }
|
| 108 |
#legend { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
|
| 109 |
gap: 0 12px; }
|
| 110 |
+
.leg { min-height: 32px; }
|
| 111 |
}
|
| 112 |
+
.leg-dot { width: 15px; height: 15px; border-radius: 3px; flex-shrink: 0;
|
| 113 |
+
border: 1px solid rgba(0,0,0,.15); }
|
| 114 |
</style>
|
| 115 |
</head>
|
| 116 |
<body>
|
|
|
|
| 374 |
}
|
| 375 |
|
| 376 |
// Axis labels
|
| 377 |
+
ctx.fillStyle="#41546B"; ctx.font="11px sans-serif";
|
| 378 |
ctx.textAlign="center"; ctx.textBaseline="top";
|
| 379 |
ctx.fillText(`${plotW} ft`, PAD.l+pw/2, PAD.t+ph+5);
|
| 380 |
ctx.save(); ctx.translate(12, PAD.t+ph/2); ctx.rotate(-Math.PI/2);
|
|
|
|
| 517 |
|
| 518 |
// One door on each room's legitimate access wall, one window on each exterior
|
| 519 |
// wall β added only if that room/side has no opening yet, so user edits stick.
|
| 520 |
+
// Only the passage gets NO door of its own β it is an open circulation strip,
|
| 521 |
+
// not a room you close. The utility and common washroom DO get doors: they are
|
| 522 |
+
// rooms people enter and shut behind them. A balcony gets NO window β it is
|
| 523 |
+
// already open to the outside.
|
| 524 |
+
const NO_DOOR = ["internal_corridor"];
|
| 525 |
const NO_WINDOW = ["balcony"];
|
| 526 |
|
| 527 |
function seedOpenings() {
|
|
|
|
| 690 |
ctx.strokeStyle="#2EA043"; ctx.lineWidth=2; ctx.setLineDash([6,4]);
|
| 691 |
ctx.strokeRect(cx,cy,cw,ch);
|
| 692 |
ctx.setLineDash([]);
|
| 693 |
+
ctx.fillStyle="#17703A"; ctx.font="bold 11px sans-serif";
|
| 694 |
ctx.textAlign="center"; ctx.textBaseline="middle";
|
| 695 |
if (cw>28 && ch>14) ctx.fillText("empty", cx+cw/2, cy+ch/2);
|
| 696 |
ctx.restore();
|
|
|
|
| 766 |
}
|
| 767 |
|
| 768 |
function drawRoadLabel(pw, ph) {
|
| 769 |
+
ctx.fillStyle="#C2410C"; ctx.font="bold 11px sans-serif";
|
| 770 |
ctx.textAlign="center"; ctx.textBaseline="middle";
|
| 771 |
const arrows={S:"βΌ ROAD",N:"β² ROAD",E:"βΆ ROAD",W:"β ROAD"};
|
| 772 |
const lbl = arrows[roadSide]||"ROAD";
|
|
|
|
| 853 |
if (!lockedPairs.length) return;
|
| 854 |
const rMap=Object.fromEntries(rooms.map(r=>[r.name,r]));
|
| 855 |
const ftY=fy=>PAD.t+(plotH-fy)*scale;
|
| 856 |
+
ctx.strokeStyle="#17703A"; ctx.lineWidth=3.5; ctx.setLineDash([]);
|
| 857 |
for (const [a,b] of lockedPairs) {
|
| 858 |
const ra=rMap[a], rb=rMap[b];
|
| 859 |
if (!ra||!rb) continue;
|
|
|
|
| 1317 |
+ `<div class="presets">presets: ${WINDOW_PRESETS.map(p=>p.toFixed(1)+"'").join(" Β· ")}</div>`
|
| 1318 |
+ `<div class="presets" style="margin-top:7px;line-height:1.5">`
|
| 1319 |
+ `Select a door/window to change its size or delete it.<br>`
|
| 1320 |
+
+ `No door on the passage Β· no window on a balcony.`
|
| 1321 |
+ `</div>`;
|
| 1322 |
}
|
| 1323 |
|