fix: стабилизировать day-cycle при pinch в HA Companion (#582)

После первого движения камеры переносит фильтр контура на ограниченный размером viewport слой, сохраняя исходный статичный рендер без изменений.

Issue: #582
User-Visible: no
This commit is contained in:
Sergey Matyunin
2026-09-15 12:20:44 +03:00
parent 728c564e5f
commit 2a8b5f1dcf
58 changed files with 522 additions and 474 deletions
+10 -6
View File
@@ -4,7 +4,7 @@ import { readFileSync } from 'node:fs';
const source = (path) => readFileSync(new URL(`../${path}`, import.meta.url), 'utf8');
test('#582 day-cycle shadow uses one shared stage-bounded paper scene', () => {
test('#582 camera movement switches the day-cycle shadow to a stage-bounded scene', () => {
const helper = source('src/render/paper-scene.ts');
const card = source('src/houseplan-card.ts');
const staticRender = source('src/space-render.ts');
@@ -14,14 +14,17 @@ test('#582 day-cycle shadow uses one shared stage-bounded paper scene', () => {
assert.match(helper, /pointer-events="none"/);
assert.match(card, /dayCycle && paperShapes\.length \? svg`<svg class="hp-paper-outline-svg"/);
assert.match(card, /data-hp-live-viewbox=\$\{iso \? 'camera' : 'floor'\}/);
assert.match(staticRender, /dayCycle && paperShapes\.length \? svg`<svg class="hp-paper-outline-svg"/);
assert.doesNotMatch(staticRender, /class="hp-paper-outline-svg"/);
assert.match(card, /renderPaperShapes\(paperShapes\)/);
assert.match(staticRender, /renderPaperShapes\(paperShapes\)/);
assert.match(styles, /\.stage\.daycycle \.hp-paper-outline-svg/);
assert.doesNotMatch(styles, /\.stage\.daycycle \.hp-paperg[\s\S]{0,300}will-change:\s*filter/);
assert.match(card, /private _activateSafeDayCycleOutline\(\)/);
assert.match(card, /hp-safe-daycycle-outline/);
assert.match(styles, /\.stage\.daycycle \.hp-paperg/);
assert.match(styles, /\.stage\.daycycle\.hp-safe-daycycle-outline \.hp-paper-outline-svg/);
assert.match(styles, /\.stage\.daycycle\.hp-safe-daycycle-outline \.hp-paperg \{[\s\S]*?filter:\s*none;[\s\S]*?will-change:\s*auto;/);
});
test('#582 flat plan root is explicitly above the outline scene', () => {
test('#582 safe camera scene uses explicit bounded plan and outline layers', () => {
const card = source('src/houseplan-card.ts');
const styles = source('src/styles/plan.styles.ts');
const staticCard = source('src/space-card.ts');
@@ -29,5 +32,6 @@ test('#582 flat plan root is explicitly above the outline scene', () => {
assert.match(card, /<svg class="plan-svg"/);
assert.match(styles, /\.plan-svg \{ z-index: 1; \}/);
assert.match(styles, /\.hp-paper-outline-svg \{[\s\S]*?z-index: 0;/);
assert.match(staticCard, /\.hp-static-stage \.hp-paper-outline-svg \{[\s\S]*?z-index: 0;/);
assert.match(styles, /\.stage\.daycycle\.hp-safe-daycycle-outline \.plan-svg \{[\s\S]*?will-change:\s*transform;/);
assert.doesNotMatch(staticCard, /\.hp-static-stage \.hp-paper-outline-svg/);
});