mirror of
https://github.com/Matysh/houseplan-card
synced 2026-10-01 20:29:00 +00:00
Fix prerelease smoke regressions
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -21,8 +21,11 @@ const res = await page.evaluate(async () => {
|
||||
c._serverCfg = { ...c._serverCfg, spaces: c._serverCfg.spaces.map((s) => s.id !== 'f1' ? s : ({ ...s,
|
||||
settings: { ...(s.settings||{}), show_borders: true, fill_mode: 'light' } })) };
|
||||
c.requestUpdate(); await c.updateComplete;
|
||||
const styles = [...sr().querySelectorAll('.room.styled')].map((r) => r.getAttribute('style') || '');
|
||||
out.customFillUsed = styles.some((st) => st.includes('#ff00ff') && st.includes('0.500'));
|
||||
const styledRooms = [...sr().querySelectorAll('.room.styled')];
|
||||
out.customFillUsed = styledRooms.some((room) => (
|
||||
room.style.getPropertyValue('--room-fill').trim() === '#ff00ff'
|
||||
&& Math.abs(Number(room.style.getPropertyValue('--room-fill-op')) - 0.5) < 1e-9
|
||||
));
|
||||
// 4) show_lqi=false у пространства скрывает LQI-бейджи
|
||||
out.lqiBefore = sr().querySelectorAll('.dev .lqi').length;
|
||||
c._serverCfg = { ...c._serverCfg, spaces: c._serverCfg.spaces.map((s) => s.id !== 'f1' ? s : ({ ...s,
|
||||
|
||||
@@ -15,7 +15,12 @@ const res = await page.evaluate(async () => {
|
||||
out.styled = sr().querySelectorAll('.room.styled').length;
|
||||
out.labels = [...sr().querySelectorAll('.roomlabel')].map((l) => l.textContent.trim());
|
||||
const liv = [...sr().querySelectorAll('.room.styled')][0];
|
||||
out.livingStyle = liv.getAttribute('style');
|
||||
out.livingStyle = {
|
||||
stroke: liv.style.getPropertyValue('--room-stroke').trim(),
|
||||
strokeOpacity: Number(liv.style.getPropertyValue('--room-stroke-op')),
|
||||
fill: liv.style.getPropertyValue('--room-fill').trim(),
|
||||
fillOpacity: Number(liv.style.getPropertyValue('--room-fill-op')),
|
||||
};
|
||||
// living: ceiling on → жёлтая; kitchen: нет light-сущностей → без заливки; bedroom light off → серая
|
||||
const styles = [...sr().querySelectorAll('.room.styled')].map((r) => r.getAttribute('style'));
|
||||
out.hasYellow = styles.some((s) => s.includes('#ffd45c'));
|
||||
@@ -54,7 +59,7 @@ checkAll(res, {
|
||||
"defaultLabels": 0,
|
||||
"styled": 4,
|
||||
"labels": ["Living room", "Kitchen", "Bedroom", "Hallway"],
|
||||
"livingStyle": "--room-stroke:#ff8800;--room-stroke-op:0.8;--room-fill:#ffd45c;--room-fill-op:0.180",
|
||||
"livingStyle": {"stroke": "#ff8800", "strokeOpacity": 0.8, "fill": "#ffd45c", "fillOpacity": 0.18},
|
||||
"lqiFills": 0,
|
||||
"atticSquare": true,
|
||||
// fill_mode 'glow' — the default for NEW spaces since v1.54 (owner call).
|
||||
|
||||
File diff suppressed because one or more lines are too long
Vendored
+2
-2
File diff suppressed because one or more lines are too long
+10
-2
@@ -1669,6 +1669,10 @@ export interface OpeningWallPiece {
|
||||
export interface OpeningWallSide {
|
||||
roomId: string;
|
||||
side: -1 | 1;
|
||||
/** First matching room edge in config order. Symbols historically use that
|
||||
* order to choose their default face on an inherently ambiguous shared wall;
|
||||
* tunnel ownership still uses compareOpeningSides below. */
|
||||
order: number;
|
||||
pieces: OpeningWallPiece[];
|
||||
faceDistance: number;
|
||||
area: number;
|
||||
@@ -1735,6 +1739,7 @@ export function resolveOpeningWallAssociation(
|
||||
const openingHalf = length / 2;
|
||||
const eps = Math.max(1e-9, index.adjacencyEps);
|
||||
const candidates = new Map<string, OpeningWallSide>();
|
||||
let candidateOrder = 0;
|
||||
|
||||
for (const edge of index.edges) {
|
||||
if (physicalOnly && !(edge.half > 0)) continue;
|
||||
@@ -1767,7 +1772,7 @@ export function resolveOpeningWallAssociation(
|
||||
previous.faceDistance = Math.min(previous.faceDistance, faceDistance);
|
||||
} else {
|
||||
candidates.set(key, {
|
||||
roomId: edge.roomId, side, pieces: [piece], faceDistance,
|
||||
roomId: edge.roomId, side, order: candidateOrder++, pieces: [piece], faceDistance,
|
||||
area: edge.area, coverage: 0, full: false,
|
||||
});
|
||||
}
|
||||
@@ -1824,7 +1829,10 @@ export function openingInnerFaceOffsetFromIndex(
|
||||
const association = resolveOpeningWallAssociation(index, opening);
|
||||
const available = [association.negative, association.positive]
|
||||
.filter((side): side is OpeningWallSide => !!side)
|
||||
.sort(compareOpeningSides);
|
||||
// Preserve the pre-index symbol behaviour: on a shared wall the first room
|
||||
// in model order owns the unflipped face. This is separate from tunnel
|
||||
// ownership, whose geometric tie-breaks must remain order-independent.
|
||||
.sort((a, b) => a.order - b.order);
|
||||
if (!available.length) return { ox: 0, oy: 0, cm: 0, side: -1 };
|
||||
const natural = available[0];
|
||||
const selectedSide = (opening.flip_v ? -natural.side : natural.side) as -1 | 1;
|
||||
|
||||
@@ -348,6 +348,18 @@ test('opening face side is known without wall thickness and can be inverted for
|
||||
assert.equal(bottomInner.side, -1, 'the bottom wall room side is -Y');
|
||||
});
|
||||
|
||||
test('opening face keeps the first room side on an ambiguous shared wall', () => {
|
||||
const rooms = [
|
||||
{ id: 'large-first', poly: [[0, 0], [10, 0], [10, 8], [0, 8]] },
|
||||
{ id: 'small-second', poly: [[3, 8], [7, 8], [7, 11], [3, 11]] },
|
||||
];
|
||||
const opening = { x: 5, y: 8, angle: 0, length: 2 };
|
||||
const natural = openingInnerFaceOffset(rooms, opening, [], pitch, cellCm, pitch);
|
||||
const flipped = openingInnerFaceOffset(rooms, { ...opening, flip_v: true }, [], pitch, cellCm, pitch);
|
||||
assert.equal(natural.side, -1, 'the first room is above the wall, so its inner face is -Y');
|
||||
assert.equal(flipped.side, 1, 'flip_v selects the opposite face without an area-based side swap');
|
||||
});
|
||||
|
||||
test('openingTunnelGeometry: an outer thick wall gives the one room both tunnel halves', () => {
|
||||
const rooms = [{ id: 'r', poly: [[0, 0], [10, 0], [10, 6], [0, 6]] }];
|
||||
const walls = [{ key: wallKey([0, 0], [10, 0], pitch), cm: 20 }];
|
||||
|
||||
Reference in New Issue
Block a user