feat: add room name switches to 3D view and editor toolbars

This commit is contained in:
jhartworks committed 2026-11-10 10:41:07 +01:00
1 parent 7a9b2c0a38
commit 3f6cca056c
13 files changed
+695 -585

No files matched your search

+9 -1
View File
@@ -184,6 +184,7 @@ export class NfEditor extends LitElement {
hass: { attribute: false },
building: { attribute: false },
narrow: { type: Boolean },
roomLabels: { attribute: false },
packs: { attribute: false },
loadCardEditor: { attribute: false },
_doc: { state: true },
@@ -223,6 +224,8 @@ export class NfEditor extends LitElement {
declare hass: HomeAssistant;
declare building: Building;
declare narrow: boolean;
/** Show room names in the 3D preview; the host remembers this view preference. */
declare roomLabels: boolean;
/** Imported furniture packs (from the panel's controller). */
declare packs: FurniturePack[] | undefined;
/** Loads the card's settings dialog, for the card templates (set by the panel). */
@@ -319,6 +322,7 @@ export class NfEditor extends LitElement {
constructor() {
super();
this.narrow = false;
this.roomLabels = true;
this._floorId = null;
this._arcEdit = null;
this._routeDraft = null;
@@ -1067,7 +1071,7 @@ export class NfEditor extends LitElement {
.selectedDevice=${this.sel.device}
.quality=${"auto"}
.floorThumbs=${false}
.roomLabels=${true}
.roomLabels=${this.roomLabels}
.floorStack=${this.houseTool ? "stacked" : "single"}
.panelOpen=${false}
.alerts=${false}
@@ -3184,6 +3188,10 @@ export class NfEditor extends LitElement {
</button>`,
)}
</div>
<button class="nf-chip nf-room-names-toggle" aria-pressed=${this.roomLabels} title=${this.t("room_names_toggle_hint")} @click=${() => {
this.roomLabels = !this.roomLabels;
this.dispatchEvent(new CustomEvent("room-names-change", { detail: { value: this.roomLabels }, bubbles: true, composed: true }));
}}>${this.t("room_names_short")}</button>
<div class="nf-seg">
<button ?disabled=${!this._canUndo} @click=${() => this.undo()} title="Ctrl+Z">${this.t("undo")}</button>
<button ?disabled=${!this._canRedo} @click=${() => this.redo()} title="Ctrl+Y">${this.t("redo")}</button>