diff --git a/ops/home/plans/zones-check.png b/ops/home/plans/zones-check.png index 418a4aa..baf835c 100644 Binary files a/ops/home/plans/zones-check.png and b/ops/home/plans/zones-check.png differ diff --git a/ops/home/rooms-card.js b/ops/home/rooms-card.js index d1a62ca..35bb45c 100644 --- a/ops/home/rooms-card.js +++ b/ops/home/rooms-card.js @@ -1,21 +1,23 @@ -/* Покомнатная панель: план владельца + зоны-полигоны по контурам комнат. */ +/* Покомнатная панель: план-подложка (img) + слой зон (SVG) по контурам комнат. */ const ROOMS = [ { id: "terrasa", name: "Терраса", icon: "mdi:deck", - poly: [[0, 0], [2.45, 0], [2.45, 8.35], [0, 8.35]] }, + poly: [[0.00, 0.00], [2.45, 0.00], [2.45, 8.35], [0.00, 8.35]] }, { id: "kitchen", name: "Кухня-гостиная", icon: "mdi:silverware-fork-knife", - poly: [[2.45, 0], [6.16, 0], [6.16, 8.35], [2.45, 8.35]] }, + poly: [[2.45, 0.00], [6.16, 0.00], [6.16, 8.35], [2.45, 8.35]] }, { id: "postirochnaia", name: "Тех.пом.", icon: "mdi:server", - poly: [[5.71, -1.5], [7.62, -1.5], [7.62, 0], [5.71, 0]] }, + poly: [[5.71, -1.50], [7.62, -1.50], [7.62, 0.00], [5.71, 0.00]] }, { id: "sanuzel", name: "Санузел", icon: "mdi:shower", - poly: [[5.83, 0.30], [7.74, 0.30], [7.74, 3.07], [5.83, 3.07]] }, + poly: [[5.83, 0.30], [7.74, 0.30], [7.74, 1.55], [7.30, 1.55], + [7.30, 3.07], [5.83, 3.07]] }, { id: "tualet", name: "Туалет", icon: "mdi:toilet", - poly: [[8.69, 2.71], [9.40, 2.71], [9.40, 3.55], [8.69, 3.55]] }, + poly: [[7.74, 1.90], [8.62, 1.90], [8.62, 3.55], [7.74, 3.55]] }, { id: "garderob", name: "Гардероб", icon: "mdi:hanger", poly: [[9.05, 0.05], [10.95, 0.05], [10.95, 1.50], [9.05, 1.50]] }, { id: "kladovaia", name: "Кладовая", icon: "mdi:package-variant", poly: [[9.29, 1.50], [10.95, 1.50], [10.95, 2.83], [9.29, 2.83]] }, { id: "koridor", name: "Холл", icon: "mdi:door-open", - poly: [[7.74, 3.07], [11.07, 3.07], [11.07, 5.48], [7.74, 5.48]] }, + poly: [[7.74, 3.07], [9.05, 3.07], [9.05, 2.83], [11.07, 2.83], + [11.07, 5.48], [7.74, 5.48]] }, { id: "prihozhaya", name: "Прихожая", icon: "mdi:door", poly: [[5.95, 5.48], [7.74, 5.48], [7.74, 7.41], [5.95, 7.41]] }, { id: "tambur", name: "Тамбур", icon: "mdi:door", @@ -101,16 +103,17 @@ class RoomsCard extends HTMLElement { if (d === "light" || d === "switch") this._hass.callService(d, "toggle", { entity_id: e }); } - _planSvg(areaId) { + _planHtml(areaId) { const pts = (poly) => poly.map(([x, y]) => `${(x * PX_M + PX0).toFixed(1)},${(y * PY_M + PY0).toFixed(1)}`).join(" "); const shapes = ROOMS.map((r) => { const sel = r.id === areaId; - return ``; + return `${r.name}`; }).join(""); - return ` - - ${shapes}`; + return `
+ План дома + ${shapes} +
`; } _render() { @@ -158,9 +161,11 @@ class RoomsCard extends HTMLElement { .bar button { background:rgba(30,36,44,.9); color:#cfe0f0; border:1px solid #39424e; border-radius:9px; padding:4px 10px; font-size:12px; cursor:pointer; } .bar button.on { border-color:#4aa3ff; color:#dceaff; background:rgba(74,163,255,.16); } - .plan { display:block; width:100%; height:auto; border-radius:12px; background:#f7f7f4; } + .plan-wrap { position:relative; line-height:0; border-radius:12px; overflow:hidden; background:#f7f7f4; } + .plan-img { display:block; width:100%; height:auto; } + .plan-layer { position:absolute; inset:0; width:100%; height:100%; } .zone { fill:rgba(47,127,224,0); stroke:rgba(47,127,224,0); stroke-width:2; cursor:pointer; transition:.12s; } - .zone:hover { fill:rgba(47,127,224,.18); stroke:rgba(47,127,224,.85); } + .zone:hover { fill:rgba(47,127,224,.18); stroke:rgba(47,127,224,.9); } .zone.sel { fill:rgba(47,127,224,.30); stroke:rgba(20,90,200,1); stroke-width:3; } .grid { display:grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap:10px; } .tile { text-align:left; border:1px solid #2a2f36; border-radius:14px; @@ -188,7 +193,7 @@ class RoomsCard extends HTMLElement { - ${this._mode === "plan" ? this._planSvg(areaId) : `
${tiles}
`} + ${this._mode === "plan" ? this._planHtml(areaId) : `
${tiles}
`} ${detail}`; this.shadowRoot.querySelectorAll("[data-mode]").forEach((b) =>