fix: auto-close rooms along shared walls

Issue: #138
User-Visible: yes
This commit is contained in:
Sergey Matyunin
2026-08-14 15:45:08 +03:00
parent 1dbded5b73
commit ca7dbeda92
13 changed files with 545 additions and 219 deletions
+10
View File
@@ -414,6 +414,16 @@ field. Double click edits physical-object properties, pointer drag moves the
whole object on the grid, and Delete removes only the selected object. The
legacy root `space.segments` array is still stripped on every save.
Adjacent-room auto-close reuses the immutable architectural snap snapshot and
requires the first and prospective terminal points to belong to one completed
room's same solid segment after opening/open-span cuts. It runs only after the
draft has two edges and after explicit first-point/Ctrl closure handling. The
prospective polygon is checked for range, self-intersection and room overlap
before `_path` or `room_drafts` changes; success persists the terminal segment
and then opens the ordinary room dialog. Cancel therefore returns to the open
draft at that terminal point, while Save lets the normal room/wall
normalization preserve an existing shared wall's thickness.
While drawing, the length of the current segment follows the cursor (`_fmtLen` → `segmentCm`/
`formatLength`): metres, or feet+inches when `hass.config.unit_system` is imperial. The scale is
per-space `cell_cm` — cm represented by one grid cell (default 5, so 240 cells ≈ 12 m).
+10
View File
@@ -569,3 +569,13 @@ current anchor is excluded to prevent zero-length segments, while the first
point of a valid room outline remains an explicit closure target. The static
geometry is cached by structural editor state; pointer movement changes at
most the single active candidate and never writes config, layout or storage.
For **Room outline**, the same completed-room provenance also enables adjacent
auto-close. Once the draft already has two edges, a click that places its next
point on the same uninterrupted solid room-wall segment as the first point is
validated as the prospective polygon before any mutation. A valid click
persists that terminal draft segment and opens the standard room dialog with
the existing wall as the closing edge. A cut, a different edge, a saved draft
or an independent partition is ineligible; an eligible but invalid polygon is
reported without appending a point or segment. Explicit first-point and
Ctrl/Cmd closure retain priority.
+5
View File
@@ -2,6 +2,11 @@
## Unreleased
- A new room outline that starts and ends on one uninterrupted solid interval
of an existing room wall now closes automatically and opens the normal room
dialog. Endpoints and wall-bound T-connection points work alike; openings,
intentional gaps, different edges and a second point without enough sides do
not trigger the shortcut ([#138](https://github.com/Matysh/houseplan-card/issues/138)).
- Connected Room outline and Partition segments now form one seamless thick
wall immediately, including the live rubber-band. Right and oblique corners
use bounded mitre/bevel joins, T-connections have no visible butt face, each
+6
View File
@@ -8,6 +8,12 @@
## Unreleased
- Новый контур комнаты, начатый и законченный на одном непрерывном сплошном
участке стены существующей комнаты, теперь замыкается автоматически и
открывает обычный диалог комнаты. Одинаково работают конечные узлы и точки
T-соединения на линии; проёмы, намеренные разрывы, разные грани и второй клик
без достаточного числа сторон быстрым замыканием не считаются
([#138](https://github.com/Matysh/houseplan-card/issues/138)).
- Соединённые отрезки «Контура комнаты» и «Перегородки» теперь сразу, включая
активный rubber-band, образуют одну бесшовную толстую стену. Прямые и косые
углы получают ограниченный mitre/bevel, T-соединение не показывает торец,
+12
View File
@@ -362,6 +362,18 @@ separately promised workflows:
- [ ] Ctrl/Cmd+click closes the current endpoint back to the first point without
adding another vertex. It requires at least two existing edges and refuses
degenerate or self-intersecting closure [auto: smoke_editor_tabs]
- [ ] Adjacent-room auto-close: after two drawn edges, ending on the same
uninterrupted solid existing-room wall interval as the first point adds
the terminal segment and opens the normal room dialog. Endpoints and
wall-interior snap points both work; Save creates one room without an
independent partition and preserves the shared wall thickness. Cancel
restores the open draft ending at that point [auto: smoke_room_autoclose;
unit: plan-snap-overlay.test.mjs]
- [ ] Adjacent-room auto-close safety: a second point alone stays open; different
room edges, draft/partition-only axes and points separated by an opening
or open-span cut do not trigger it. An eligible self-intersecting contour
shows the existing error and writes neither the terminal point nor segment
[auto: smoke_room_autoclose; unit: plan-snap-overlay.test.mjs]
- [ ] Room dialog: area list shows only unassigned areas; picking an area prefills the name
- [ ] Room dialog uses the medium width and its body has no horizontal overflow;
long options stay inside it at desktop and narrow widths [auto:
+6
View File
@@ -263,6 +263,12 @@ desktop: для точного рисования, Resize, модификато
5. Замкните контур кликом по первой точке или `Ctrl` + кликом в любом месте.
Быстрое замыкание доступно после двух нарисованных граней и не сработает,
если замыкающая стена создаёт самопересечение.
Если первая и текущая точки лежат на одном непрерывном сплошном участке
стены существующей комнаты, текущий клик сам добавит последнюю грань,
замкнёт контур общей стеной и откроет тот же диалог. Можно попадать как в
конечный узел, так и в точку на линии. Проём или намеренный разрыв разделяет
участок, разные грани не объединяются, а второй клик после единственной
первой точки остаётся обычным незамкнутым отрезком.
6. В диалоге задайте название, выберите свободную HA-зону либо оставьте в списке «— без зоны —», затем нажмите «Сохранить».
Во время рисования показываются длина сегмента и угол. Углы, кратные 45°, выделяются. Удерживайте `Shift`, чтобы зафиксировать текущий отрезок по ближайшему такому направлению; предпросмотр и поставленная точка останутся на сетке. Новая комната не может частично перекрывать другую, но полностью вложенная «островная» комната поддерживается.