[HOME] План на вкладке 3D: убрана фото-подложка, план рисуется картой; клик по дому прокручивает к плану выбранной комнаты
lint / hygiene (push) Failing after 21s
lint / hygiene (push) Failing after 21s
This commit is contained in:
1 parent
d37fe91b1a
commit
f901d51b46
1 file changed
+10
-5
+10
-5
@@ -62,6 +62,11 @@ class RoomsCard extends HTMLElement {
|
||||
this._selected = room || null;
|
||||
this._mode = "plan";
|
||||
this._render();
|
||||
// клик по дому — показываем план этой комнаты
|
||||
window.setTimeout(() => {
|
||||
const w = this.shadowRoot.querySelector(".plan-wrap");
|
||||
if (w && w.scrollIntoView) w.scrollIntoView({ behavior: "smooth", block: "center" });
|
||||
}, 60);
|
||||
};
|
||||
document.addEventListener("house3d-room", this._on3d);
|
||||
}
|
||||
@@ -169,8 +174,7 @@ class RoomsCard extends HTMLElement {
|
||||
});
|
||||
}
|
||||
return `<div class="plan-wrap">
|
||||
<img class="underlay" src="/local/house3d/plan.png?v=2" alt="План"/>
|
||||
<svg class="layer" viewBox="0 0 ${PLAN_W} ${PLAN_H}" preserveAspectRatio="none">
|
||||
<svg class="plan" viewBox="170 100 640 510" preserveAspectRatio="xMidYMid meet">
|
||||
${shapes}${labels}${tmp}
|
||||
</svg></div>`;
|
||||
}
|
||||
@@ -275,8 +279,8 @@ 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-wrap { position:relative; line-height:0; border-radius:12px; overflow:hidden; background:#f7f7f4; }
|
||||
.underlay { display:block; width:100%; height:auto; }
|
||||
.plan-wrap { position:relative; border-radius:12px; overflow:hidden; background:#0f151c; }
|
||||
.plan { display:block; width:100%; height:auto; }
|
||||
.layer { position:absolute; inset:0; width:100%; height:100%; cursor:crosshair; }
|
||||
.zone { fill:rgba(47,127,224,0.10); stroke:rgba(47,127,224,0.75); stroke-width:2; cursor:pointer; }
|
||||
.zone:hover { fill:rgba(47,127,224,0.25); }
|
||||
@@ -387,7 +391,8 @@ class RoomsCard extends HTMLElement {
|
||||
this.shadowRoot.querySelectorAll(".tile").forEach((el) =>
|
||||
el.addEventListener("click", () => {
|
||||
this._selected = this._selected === el.dataset.a ? null : el.dataset.a;
|
||||
document.dispatchEvent(new CustomEvent("house3d-select",
|
||||
window.setTimeout(() => { const w = this.shadowRoot.querySelector('.plan-wrap'); if (w && w.scrollIntoView) w.scrollIntoView({ behavior: 'smooth', block: 'center' }); }, 50);
|
||||
document.dispatchEvent(new CustomEvent("house3d-select",
|
||||
{ detail: { room: this._selected ? "zone_" + this._selected : null } }));
|
||||
this._render();
|
||||
}));
|
||||
|
||||
Reference in new issue
Block a user