mirror of
https://github.com/Matysh/houseplan-card
synced 2026-07-31 16:38:31 +00:00
- splitRoomPath in logic.ts: wall-to-wall polyline cut with interior vertices; validates wall crossings, self-intersection, degenerate parts; splitRoom delegates (2-point path); +3 unit tests (93 total) - split UI: interior clicks add snapped intermediate points, live polyline + vertices + preview; new/updated toasts - cursors: pointer for merge/delroom and split room-pick stage, crosshair while cutting (stage tool-* classes) - Esc: split — drop last point, then room pick, then back to draw; merge — clear selection, then back to draw - smoke_split_polyline.mjs (14 checks); TESTING/CHANGELOG same-commit
25 lines
1.3 KiB
JavaScript
25 lines
1.3 KiB
JavaScript
import { launch } from './serve.mjs';
|
|
const { page, browser } = await launch();
|
|
const res = await page.evaluate(async () => {
|
|
const out = {};
|
|
const c = window.__card;
|
|
const sr = () => c.shadowRoot || c.renderRoot;
|
|
c._setMode('plan'); c._tool = 'merge'; await c.updateComplete;
|
|
const room = c._spaceModel().rooms.find((r) => r.name);
|
|
c._mergeSel = room.id; c.requestUpdate(); await c.updateComplete;
|
|
await new Promise((r) => setTimeout(r, 250)); // дождаться transition 0.12s
|
|
const el = [...sr().querySelectorAll('.room')].find((e) => e.classList.contains('picked'));
|
|
out.pickedRendered = !!el;
|
|
const cs = el ? getComputedStyle(el) : null;
|
|
out.amberStroke = cs ? cs.stroke.includes('255, 193, 77') : null;
|
|
out.amberFill = cs ? cs.fill.includes('255, 193, 77') : null;
|
|
// split-выбор подсвечивается так же
|
|
c._mergeSel = null; c._tool = 'split'; c._splitSel = { roomId: room.id, pts: [] }; c.requestUpdate(); await c.updateComplete;
|
|
await new Promise((r) => setTimeout(r, 250));
|
|
const el2 = [...sr().querySelectorAll('.room')].find((e) => e.classList.contains('picked'));
|
|
out.splitPicked = !!el2 && getComputedStyle(el2).stroke.includes('255, 193, 77');
|
|
return out;
|
|
});
|
|
console.log(JSON.stringify(res));
|
|
await browser.close();
|