fix: preserve authored wall paths across identity barrier

Issue: #282
User-Visible: yes
This commit is contained in:
Matysh
2026-08-26 02:21:15 +03:00
parent 71ac4a6639
commit 07402d64cc
5 changed files with 28 additions and 5 deletions
+10 -2
View File
@@ -7353,7 +7353,15 @@ class HouseplanCard extends LitElement {
let safe = false;
try {
const afterSpace = committedCandidate.spaces.find((space: any) => space.id === before.spaceId);
safe = wallModelOffGridValueCount(afterSpace) <= wallModelOffGridValueCount(historyBefore)
// A completed point of the active, grid-snapped chain is authored input,
// even before its first draft record exists in `before`. Include that
// transient carrier in the growth baseline; later conversion from draft
// to room/partition must not count the same coordinate as newly derived.
const authoredPoints = this._path.length >= 2
? this._path.map((point) => [point[0] / NORM_W, point[1] / NORM_W])
: [];
safe = wallModelOffGridValueCount(afterSpace)
<= wallModelOffGridValueCount(historyBefore, authoredPoints)
&& this._checkSpacePhysicalGeometry(committedCandidate, before.spaceId).ok;
} catch {
safe = false;
@@ -13692,7 +13700,7 @@ class HouseplanCard extends LitElement {
else delete sp.walls;
}
this._commitPhysicalGeometry(this._t('history.wall_face_batch'), before);
if (!this._commitPhysicalGeometry(this._t('history.wall_face_batch'), before)) return;
delete this._resumeDraftBySpace[this._space];
this._path = [];
this._activeDraftId = null;
+6 -1
View File
@@ -80,7 +80,9 @@ const canonicalSpan = (a: number[], b: number[]): [Point, Point] => (
const lengthOf = (a: number[], b: number[]): number => Math.hypot(b[0] - a[0], b[1] - a[1]);
/** Unique authored/derived contour coordinates that are materially off-grid. */
export const wallModelOffGridValueCount = (space: any): number => {
export const wallModelOffGridValueCount = (
space: any, additionalPoints: readonly (readonly number[])[] = [],
): number => {
const values = new Set<string>();
const inspect = (value: unknown): void => {
const number = Number(value);
@@ -101,6 +103,9 @@ export const wallModelOffGridValueCount = (space: any): number => {
inspect(segment?.b?.[0]); inspect(segment?.b?.[1]);
}
}
for (const additionalPoint of additionalPoints) {
inspect(additionalPoint?.[0]); inspect(additionalPoint?.[1]);
}
return values.size;
};
const projectT = (p: number[], a: number[], b: number[]): number => {