feat v1.21.0: merge and split rooms

- Merge: click a room, then a neighbour. Adjacency is decided by the RESULT, not a
  heuristic: mergeRooms unions the outlines and accepts only when they collapse into one
  hole-free outline (corner touch / apart / hole => refused). A dialog picks the surviving
  name+area; the kept room keeps its id so its label and devices stay put.
- Split: click the room, then two wall points; the chord cuts it, live ruler on the cut.
  The bigger part stays the room (name/area/devices), the smaller opens the new-room
  dialog. The cut is applied only on confirm — Cancel leaves the room whole.
- Boolean geometry via polyclip-ts (proper ESM + native types; polygon-clipping ships
  named types but a default-only ESM build, breaking either tsc or the runtime).
  Verified on the real plan, where neighbouring walls overlap collinearly rather than
  match exactly — the case a hand-rolled union gets wrong. Bundle 151->202 KB.
+5 tests (72). Verified live: merge of Сауна+с/у -> 4-vertex outline, non-adjacent
refused, split preserves area (26667 -> 13333+13333), cancel leaves the room whole.
This commit is contained in:
Matysh
2026-07-16 08:10:24 +03:00
parent 1552bff99a
commit b706ad4b49
15 changed files with 753 additions and 261 deletions
+208 -10
View File
@@ -14,6 +14,7 @@ import {
import {
lqiColor, snapToGrid, samePoint, pointInPolygon, markerIdForBinding,
segmentCm, formatLength, roomEdges, roomPoly, pointStrictlyInside, roomsOverlap,
pointOnBoundary, mergeRooms, splitRoom, polygonArea,
averageLqi, fitView, declump, safeUrl, resolveTapAction, floorsOf, type FloorInfo,
spaceDisplayOf, roomFillColor, DEFAULT_ROOM_COLOR, DEFAULT_ROOM_OPACITY,
DEFAULT_TEMP_MIN, DEFAULT_TEMP_MAX, type SpaceDisplay,
@@ -27,14 +28,14 @@ import './space-card';
import { cardStyles } from './styles';
import { langOf, t, type I18nKey } from './i18n';
const CARD_VERSION = '1.20.0';
const CARD_VERSION = '1.21.0';
const LS_KEY = 'houseplan_card_layout_v1';
const LS_CFG = 'houseplan_card_cfg_v1'; // cache of the server config+layout for instant rendering
const LS_ZOOM = 'houseplan_card_zoom_v1';
const NORM_W = 1000; // width of the render space for normalized configs
const GRID_N = 240; // grid points across the plan width (half the previous step; old nodes are a subset of the new ones, positions are preserved)
type MarkupTool = 'draw' | 'delroom';
type MarkupTool = 'draw' | 'merge' | 'split' | 'delroom';
const fireEvent = (node: EventTarget, type: string, detail?: unknown) => {
const ev = new Event(type, { bubbles: true, composed: true }) as any;
@@ -81,6 +82,11 @@ class HouseplanCard extends LitElement {
private _tool: MarkupTool = 'draw';
private _path: number[][] = []; // current outline (render units, vertices snapped to the grid)
private _cursorPt: number[] | null = null;
private _mergeSel: string | null = null; // first room picked for a merge
private _mergeDialog: { aId: string; bId: string; poly: number[][]; pick: 'a' | 'b' } | null = null;
private _splitSel: { roomId: string; a: number[] | null } | null = null; // room being cut + first wall point
// a split is applied only when the new room's dialog is confirmed — cancel leaves the room intact
private _pendingSplit: { roomId: string; mainPoly: number[][]; newPoly: number[][] } | null = null;
private _areaSel = '';
private _nameSel = '';
private _roomDialog = false;
@@ -170,6 +176,9 @@ class HouseplanCard extends LitElement {
_tool: { state: true },
_path: { state: true },
_cursorPt: { state: true },
_mergeSel: { state: true },
_mergeDialog: { state: true },
_splitSel: { state: true },
_areaSel: { state: true },
_nameSel: { state: true },
_roomDialog: { state: true },
@@ -966,6 +975,10 @@ class HouseplanCard extends LitElement {
this._path = [];
this._cursorPt = null;
this._tool = 'draw';
this._mergeSel = null;
this._mergeDialog = null;
this._splitSel = null;
this._pendingSplit = null;
}
private _svgPoint(ev: MouseEvent): number[] {
@@ -1052,6 +1065,14 @@ class HouseplanCard extends LitElement {
this.requestUpdate();
return;
}
if (this._tool === 'merge') {
this._mergeClick(raw);
return;
}
if (this._tool === 'split') {
this._splitClick(raw);
return;
}
// draw: clicks on grid points build the outline. Nothing is written to the config
// until the contour closes — an abandoned outline leaves no lines behind.
const pt = this._snap(raw);
@@ -1088,14 +1109,103 @@ class HouseplanCard extends LitElement {
this._path = [...this._path, pt];
}
/** Merge: first click picks a room, second picks the room to merge it with. */
private _mergeClick(raw: number[]): void {
const rooms = this._spaceModel().rooms;
const hit = [...rooms].reverse().find((r) => this._pointInRoom(raw, r));
if (!hit?.id) return;
const hitId = hit.id;
if (!this._mergeSel || this._mergeSel === hitId) {
this._mergeSel = this._mergeSel === hitId ? null : hitId; // click again = deselect
return;
}
const a = rooms.find((r) => r.id === this._mergeSel);
const pa = a ? roomPoly(a) : null;
const pb = roomPoly(hit);
const merged = pa && pb ? mergeRooms(pa, pb) : null;
if (!merged) {
// only rooms sharing a wall collapse into one outline (see mergeRooms)
this._showToast(this._t('toast.merge_not_adjacent'));
this._mergeSel = null;
return;
}
this._mergeDialog = { aId: this._mergeSel, bId: hitId, poly: merged, pick: 'a' };
this._mergeSel = null;
}
private _commitMerge(): void {
const d = this._mergeDialog;
const sp = this._curSpaceCfg;
if (!d || !sp) return;
const H = this._spaceH;
const keepId = d.pick === 'a' ? d.aId : d.bId;
const dropId = d.pick === 'a' ? d.bId : d.aId;
const keep = sp.rooms.find((r: any) => r.id === keepId);
if (!keep) {
this._mergeDialog = null;
return;
}
// the kept room keeps its id, so its label position and devices stay put
keep.poly = d.poly.map((p) => [p[0] / NORM_W, p[1] / H]);
delete keep.x; delete keep.y; delete keep.w; delete keep.h; // a merged room is never a rect
sp.rooms = sp.rooms.filter((r: any) => r.id !== dropId);
this._saveConfig();
this._mergeDialog = null;
this._regSignature = '';
this._maybeRebuildDevices();
this._showToast(this._t('toast.rooms_merged', { name: keep.name || '' }));
}
/** Split: click the room, then two points on its walls. */
private _splitClick(raw: number[]): void {
const rooms = this._spaceModel().rooms;
if (!this._splitSel) {
const hit = [...rooms].reverse().find((r) => this._pointInRoom(raw, r));
if (!hit?.id) return;
this._splitSel = { roomId: hit.id, a: null };
return;
}
const room = rooms.find((r) => r.id === this._splitSel!.roomId);
const poly = room ? roomPoly(room) : null;
if (!room || !poly) {
this._splitSel = null;
return;
}
const eps = this._gridPitch * 0.02;
const pt = this._snap(raw);
if (!pointOnBoundary(pt, poly, eps)) {
this._showToast(this._t('toast.split_pick_wall'));
return;
}
if (!this._splitSel.a) {
this._splitSel = { ...this._splitSel, a: pt };
return;
}
const parts = splitRoom(poly, this._splitSel.a, pt, eps);
if (!parts) {
this._showToast(this._t('toast.split_bad_cut'));
return;
}
// the bigger part stays the room it was — name, area and devices go with it
const [p1, p2] = parts;
const main = polygonArea(p1) >= polygonArea(p2) ? p1 : p2;
const fresh = main === p1 ? p2 : p1;
this._pendingSplit = { roomId: room.id!, mainPoly: main, newPoly: fresh };
this._cursorPt = null;
this._nameSel = '';
this._areaSel = '';
this._roomDialog = true;
}
private get _contourClosed(): boolean {
return this._path.length >= 4 && this._samePt(this._path[0], this._path[this._path.length - 1]);
}
private _markupMove(ev: MouseEvent): void {
if (!this._markup || this._tool !== 'draw' || !this._path.length || this._contourClosed) {
return;
}
if (!this._markup) return;
const drawing = this._tool === 'draw' && this._path.length && !this._contourClosed;
const cutting = this._tool === 'split' && !!this._splitSel?.a;
if (!drawing && !cutting) return;
this._cursorPt = this._snap(this._svgPoint(ev));
}
@@ -1113,11 +1223,26 @@ class HouseplanCard extends LitElement {
}
private _commitRoom(): void {
if (!this._contourClosed) return;
const sp = this._curSpaceCfg;
if (!sp) return;
const H = this._spaceH;
const verts = this._path.slice(0, -1); // without the duplicated closing vertex
let verts: number[][];
if (this._pendingSplit) {
// apply the cut now: the bigger part keeps the original room, this dialog names the rest
const main = sp.rooms.find((r: any) => r.id === this._pendingSplit!.roomId);
if (!main) {
this._pendingSplit = null;
this._splitSel = null;
this._roomDialog = false;
return;
}
main.poly = this._pendingSplit.mainPoly.map((p) => [p[0] / NORM_W, p[1] / H]);
delete main.x; delete main.y; delete main.w; delete main.h;
verts = this._pendingSplit.newPoly;
} else {
if (!this._contourClosed) return;
verts = this._path.slice(0, -1); // without the duplicated closing vertex
}
const areaName = this._areaSel ? this.hass.areas[this._areaSel]?.name : '';
sp.rooms.push({
id: 'r' + Date.now().toString(36),
@@ -1127,6 +1252,8 @@ class HouseplanCard extends LitElement {
});
this._saveConfig();
this._path = [];
this._pendingSplit = null;
this._splitSel = null;
const boundArea = this._areaSel;
this._areaSel = '';
this._nameSel = '';
@@ -1164,11 +1291,21 @@ class HouseplanCard extends LitElement {
this._path = [];
this._cursorPt = null;
this._roomDialog = false;
this._pendingSplit = null;
this._splitSel = null;
this._mergeSel = null;
this._mergeDialog = null;
}
/** Cancel in the dialog: the outline is open again (the closing point is removed). */
private _roomDialogCancel(): void {
this._roomDialog = false;
if (this._pendingSplit) {
// nothing was applied yet — drop the cut entirely, the room stays whole
this._pendingSplit = null;
this._splitSel = null;
return;
}
this._undoPoint();
}
@@ -1953,6 +2090,8 @@ class HouseplanCard extends LitElement {
: nothing}
${space.rooms.filter((r) => r.area || this._markup || disp.showBorders).map((r) => {
let cls = 'room ' + (space.bg ? 'overlay' : 'yard') + (this._markup ? ' outlined' : '');
if (this._markup && (r.id === this._mergeSel || r.id === this._splitSel?.roomId))
cls += ' picked';
let style = '';
if (!this._markup && (disp.showBorders || disp.fill !== 'none')) {
cls += ' styled';
@@ -1999,7 +2138,7 @@ class HouseplanCard extends LitElement {
? space.rooms.map((r) => this._renderRoomLabel(r, space, view, disp))
: nothing}
</div>
${this._markup && this._tool === 'draw' && this._path.length && this._cursorPt && !this._contourClosed
${this._measureAnchor
? html`<div class="measurelayer">${this._renderMeasureLabel(view)}</div>`
: nothing}
</div>
@@ -2009,6 +2148,7 @@ class HouseplanCard extends LitElement {
</div>
${this._roomDialog ? this._renderRoomDialog() : nothing}
${this._mergeDialog ? this._renderMergeDialog() : nothing}
${this._spaceDialog ? this._renderSpaceDialog() : nothing}
${this._markerDialog ? this._renderMarkerDialog() : nothing}
${this._infoCard ? this._renderInfoCard() : nothing}
@@ -2122,9 +2262,18 @@ class HouseplanCard extends LitElement {
>${r.name}</div>`;
}
/** Length badge that follows the cursor while drawing the current segment. */
/** Where the live measurement starts: the last outline point, or the first split point. */
private get _measureAnchor(): number[] | null {
if (!this._markup || !this._cursorPt) return null;
if (this._tool === 'draw' && this._path.length && !this._contourClosed)
return this._path[this._path.length - 1];
if (this._tool === 'split' && this._splitSel?.a) return this._splitSel.a;
return null;
}
/** Length badge that follows the cursor while drawing a segment or a cut. */
private _renderMeasureLabel(view: { x: number; y: number; w: number; h: number }): TemplateResult {
const a = this._path[this._path.length - 1];
const a = this._measureAnchor!;
const b = this._cursorPt!;
const left = ((b[0] - view.x) / view.w) * 100;
const top = ((b[1] - view.y) / view.h) * 100;
@@ -2167,6 +2316,13 @@ class HouseplanCard extends LitElement {
x2="${this._cursorPt[0]}" y2="${this._cursorPt[1]}"></line>`
: nothing}
${path.map((p, i) => svg`<circle class="vertex ${i === 0 ? 'first' : ''}" cx="${p[0]}" cy="${p[1]}" r="${g * 0.22}"></circle>`)}
${this._tool === 'split' && this._splitSel?.a
? svg`<circle class="vertex first" cx="${this._splitSel.a[0]}" cy="${this._splitSel.a[1]}" r="${g * 0.22}"></circle>
${this._cursorPt
? svg`<line class="preview" x1="${this._splitSel.a[0]}" y1="${this._splitSel.a[1]}"
x2="${this._cursorPt[0]}" y2="${this._cursorPt[1]}"></line>`
: nothing}`
: nothing}
`;
}
@@ -2177,6 +2333,16 @@ class HouseplanCard extends LitElement {
title=${this._t('title.markup_add')}>
<ha-icon icon="mdi:vector-polyline-plus"></ha-icon>${this._t('markup.add')}
</button>
<button class="btn ${this._tool === 'merge' ? 'on' : ''}"
@click=${() => { this._tool = 'merge'; this._cancelPath(); this._tool = 'merge'; }}
title=${this._t('title.markup_merge')}>
<ha-icon icon="mdi:vector-union"></ha-icon>${this._t('markup.merge')}
</button>
<button class="btn ${this._tool === 'split' ? 'on' : ''}"
@click=${() => { this._tool = 'split'; this._cancelPath(); this._tool = 'split'; }}
title=${this._t('title.markup_split')}>
<ha-icon icon="mdi:vector-polyline-remove"></ha-icon>${this._t('markup.split')}
</button>
<button class="btn ${this._tool === 'delroom' ? 'on' : ''}" @click=${() => (this._tool = 'delroom')}
title=${this._t('title.markup_delroom')}>
<ha-icon icon="mdi:delete-outline"></ha-icon>${this._t('markup.delete')}
@@ -2477,6 +2643,38 @@ class HouseplanCard extends LitElement {
</div>`;
}
private _renderMergeDialog(): TemplateResult {
const d = this._mergeDialog!;
const rooms = this._spaceModel().rooms;
const opt = (id: string, key: 'a' | 'b') => {
const r = rooms.find((x) => x.id === id);
const area = r?.area ? this.hass.areas[r.area]?.name : null;
return html`<label class="srcrow">
<input type="radio" name="mergekeep" .checked=${d.pick === key}
@change=${() => (this._mergeDialog = { ...d, pick: key })} />
<span>${r?.name || ''} <span class="muted">· ${area || this._t('merge.no_area')}</span></span>
</label>`;
};
return html`<div class="menuwrap dialogwrap" @click=${(e: Event) => e.stopPropagation()}>
<div class="dialog" @click=${(e: Event) => e.stopPropagation()}>
<div class="hd"><ha-icon icon="mdi:vector-union"></ha-icon>${this._t('merge.header')}</div>
<div class="body">
<p class="muted">${this._t('merge.hint')}</p>
<label>${this._t('merge.keep')}</label>
${opt(d.aId, 'a')}
${opt(d.bId, 'b')}
</div>
<div class="row">
<span class="spacer"></span>
<button class="btn ghost" @click=${() => (this._mergeDialog = null)}>${this._t('btn.cancel')}</button>
<button class="btn on" @click=${this._commitMerge}>
<ha-icon icon="mdi:check"></ha-icon>${this._t('btn.save')}
</button>
</div>
</div>
</div>`;
}
private _renderRoomDialog(): TemplateResult {
const areas = this._freeAreas;
return html`<div class="menuwrap dialogwrap" @click=${(e: Event) => e.stopPropagation()}>
+13
View File
@@ -27,11 +27,15 @@
"title.configure_space": "Configure space",
"title.add_space": "Add space",
"title.markup_add": "Add a room: connect grid dots with lines until the outline closes",
"title.markup_merge": "Merge rooms: click one room, then the neighbour it shares a wall with",
"title.markup_split": "Split a room: click the room, then two points on its walls",
"title.markup_delroom": "Delete a room: click inside the room",
"title.no_area_room": "Decorative room without an HA area (e.g. a hallway)",
"title.choose_area": "Select a Home Assistant area",
"title.need_plan": "Upload a floor-plan image",
"markup.add": "Add",
"markup.merge": "Merge",
"markup.split": "Split",
"markup.delete": "Delete",
"markup.hint_points": "points: {n} · Esc/Ctrl+Z — undo a dot · close the outline by clicking the first one",
"markup.hint_start": "click a grid dot to start the outline",
@@ -94,6 +98,15 @@
"toast.cfg_save_failed": "Failed to save config: {err}",
"toast.point_in_room": "That point is inside room “{name}” — rooms must not overlap",
"toast.room_overlap": "The outline overlaps room “{name}” — rooms must not overlap",
"toast.merge_not_adjacent": "Only rooms that share a wall can be merged",
"toast.rooms_merged": "Rooms merged into “{name}”",
"toast.split_pick_wall": "Click a grid dot on the rooms wall",
"toast.split_bad_cut": "The cut must be a straight line from wall to wall, inside the room",
"merge.header": "Merge rooms",
"merge.hint": "The merged room keeps one name and one area. The other area is released — its devices leave the plan until another room claims it.",
"merge.keep": "Keep",
"merge.no_area": "no area",
"room.split_header": "New room from the split",
"toast.room_saved": "Room saved ({n}). Devices added: {added}. Outline the next one or exit markup.",
"toast.room_saved_no_area": "Room saved ({n}, no area). Outline the next one or exit markup.",
"toast.marker_needs_server": "Device editing is available after the config is moved to the server",
+13
View File
@@ -27,11 +27,15 @@
"title.configure_space": "Настроить пространство",
"title.add_space": "Добавить пространство",
"title.markup_add": "Добавить комнату: соединяйте точки сетки линиями до замкнутого контура",
"title.markup_merge": "Объединить комнаты: клик по одной, затем по соседней с общей стеной",
"title.markup_split": "Разделить комнату: клик по комнате, затем две точки на её стенах",
"title.markup_delroom": "Удалить комнату: клик внутри комнаты",
"title.no_area_room": "Декоративная комната без привязки к зоне (например, холл)",
"title.choose_area": "Выберите зону Home Assistant",
"title.need_plan": "Загрузите подложку (план этажа)",
"markup.add": "Добавить",
"markup.merge": "Объединить",
"markup.split": "Разделить",
"markup.delete": "Удалить",
"markup.hint_points": "точек: {n} · Esc/Ctrl+Z — убрать точку · замкните контур кликом по первой",
"markup.hint_start": "кликните точку сетки, чтобы начать контур",
@@ -94,6 +98,15 @@
"toast.cfg_save_failed": "Не удалось сохранить конфиг: {err}",
"toast.point_in_room": "Точка внутри комнаты «{name}» — комнаты не должны накладываться",
"toast.room_overlap": "Контур накладывается на комнату «{name}» — комнаты не должны накладываться",
"toast.merge_not_adjacent": "Объединять можно только комнаты с общей стеной",
"toast.rooms_merged": "Комнаты объединены в «{name}»",
"toast.split_pick_wall": "Кликните по узлу сетки на стене комнаты",
"toast.split_bad_cut": "Разрез — прямая от стены до стены внутри комнаты",
"merge.header": "Объединение комнат",
"merge.hint": "У объединённой комнаты одно имя и одна зона. Вторая зона освобождается — её устройства уйдут с плана, пока их не заберёт другая комната.",
"merge.keep": "Оставить",
"merge.no_area": "без зоны",
"room.split_header": "Новая комната после разделения",
"toast.room_saved": "Комната сохранена ({n}). Устройств добавлено: {added}. Обведите следующую или выйдите из разметки.",
"toast.room_saved_no_area": "Комната сохранена ({n}, без зоны). Обведите следующую или выйдите из разметки.",
"toast.marker_needs_server": "Редактирование устройств доступно после переноса конфига на сервер",
+83
View File
@@ -1,6 +1,7 @@
/**
* Pure functions with no Lit/DOM dependencies — easy to cover with unit tests.
*/
import { union } from 'polyclip-ts';
/** Zigbee LQI color: ≤40 — red, ≥180 — green, in between — an hsl gradient. */
export function lqiColor(lqi: number): string {
@@ -170,6 +171,88 @@ export function roomsOverlap(a: number[][], b: number[][], eps = 1e-6): boolean
return coversArea(a, b, eps) || coversArea(b, a, eps);
}
/** Shoelace area of an outline (absolute value). */
export function polygonArea(poly: number[][]): number {
if (!poly || poly.length < 3) return 0;
let s = 0;
for (let i = 0; i < poly.length; i++) {
const a = poly[i];
const b = poly[(i + 1) % poly.length];
s += a[0] * b[1] - b[0] * a[1];
}
return Math.abs(s) / 2;
}
function closedRing(poly: number[][]): number[][][] {
return [[...poly.map((p) => [p[0], p[1]]), [poly[0][0], poly[0][1]]]];
}
/**
* Union of two room outlines, or null when they may not be merged.
*
* "Adjacent" is decided by the result rather than by a separate heuristic: only rooms that
* genuinely share a wall (fully or partially — real walls overlap collinearly rather than
* match exactly) collapse into ONE hole-free outline. Rooms that merely touch at a corner,
* that are apart, or whose union would enclose a hole do not, and are refused.
*/
export function mergeRooms(a: number[][], b: number[][]): number[][] | null {
if (!a || !b || a.length < 3 || b.length < 3) return null;
const res = union(closedRing(a) as any, closedRing(b) as any);
if (res.length !== 1) return null; // two pieces → not adjacent
if (res[0].length !== 1) return null; // a ring plus holes → not a simple room
const pts = res[0][0].slice(0, -1).map((p: number[]) => [p[0], p[1]]); // drop the closing point
return pts.length >= 3 ? pts : null;
}
/** Index of the outline edge that p sits on, or -1. */
function edgeIndexOf(poly: number[][], p: number[], eps: number): number {
for (let i = 0; i < poly.length; i++)
if (distToSeg(p, poly[i], poly[(i + 1) % poly.length]) <= eps) return i;
return -1;
}
function dropRepeats(pts: number[][], eps: number): number[][] {
const out: number[][] = [];
for (const p of pts) if (!out.length || !samePoint(out[out.length - 1], p, eps)) out.push(p);
if (out.length > 1 && samePoint(out[0], out[out.length - 1], eps)) out.pop();
return out;
}
/**
* Cut a room in two with a straight chord between two points on its walls.
* Returns the two parts, or null when the cut is not a clean wall-to-wall chord:
* an end that is not on a wall, a chord that leaves the room (concave outlines) or that
* runs along a wall and would carve off a zero-area sliver.
*/
export function splitRoom(
poly: number[][], a: number[], b: number[], eps = 1e-6,
): [number[][], number[][]] | null {
if (!poly || poly.length < 3 || samePoint(a, b, eps)) return null;
const ia = edgeIndexOf(poly, a, eps);
const ib = edgeIndexOf(poly, b, eps);
if (ia < 0 || ib < 0) return null; // an end is not on a wall
for (let i = 0; i < poly.length; i++)
if (segmentsProperlyCross(a, b, poly[i], poly[(i + 1) % poly.length])) return null; // leaves the room
// a chord lying along a wall has its midpoint ON the outline, not inside it
if (!pointStrictlyInside([(a[0] + b[0]) / 2, (a[1] + b[1]) / 2], poly, eps)) return null;
const walk = (from: number[], fromIdx: number, to: number[], toIdx: number): number[][] => {
const pts: number[][] = [from];
let i = (fromIdx + 1) % poly.length;
for (let guard = 0; guard <= poly.length; guard++) {
pts.push(poly[i]);
if (i === toIdx) break;
i = (i + 1) % poly.length;
}
pts.push(to);
return dropRepeats(pts, eps);
};
const p1 = walk(a, ia, b, ib);
const p2 = walk(b, ib, a, ia);
if (p1.length < 3 || p2.length < 3) return null;
if (polygonArea(p1) <= eps || polygonArea(p2) <= eps) return null;
return [p1, p2];
}
/**
* Marker id by binding: device → device_id, entity → 'lg_'+entity_id,
* virtual → the passed-in existing (if it is already a v_ marker) or a new one via newId().
+5
View File
@@ -274,6 +274,11 @@ export const cardStyles = css`
.stage.markup .devlayer {
display: none; /* in markup mode icons must not get in the way */
}
.room.picked {
stroke: #ffc14d;
stroke-width: 3;
fill: rgba(255, 193, 77, 0.25);
}
.room.outlined {
stroke: rgba(62, 166, 255, 0.55);
fill: rgba(62, 166, 255, 0.06);