fix: плавно менять высоту плана при входе в редактор (#660)

Переход снова интерполирует общий бюджет сцены и панели инструментов вместо измерения скрытого исходного кадра. Документационные кадры попиксельно не изменились.

Issue: #660
User-Visible: yes
This commit is contained in:
Sergey Matyunin
2026-09-26 12:35:18 +03:00
parent 467eaf873a
commit bae6378006
4 changed files with 22 additions and 17 deletions
+2 -1
View File
@@ -10,7 +10,8 @@
modes. On desktop the summary-panel settings and show/hide buttons remain modes. On desktop the summary-panel settings and show/hide buttons remain
available in every editor (the panel itself still appears only in View), available in every editor (the panel itself still appears only in View),
while the phone menu remains View-only. Escape now leaves any editor after while the phone menu remains View-only. Escape now leaves any editor after
first dismissing its active tool, selection, drag, popover or dialog first dismissing its active tool, selection, drag, popover or dialog, without
a jump in the plan height as the editor toolbar appears or disappears
([#660](https://github.com/Matysh/houseplan-card/issues/660)). ([#660](https://github.com/Matysh/houseplan-card/issues/660)).
- A cold dashboard load with 2.5D enabled no longer briefly shows the flat plan - A cold dashboard load with 2.5D enabled no longer briefly shows the flat plan
or classifies every floor as dark on its first frame. The neutral House Plan or classifies every floor as dark on its first frame. The neutral House Plan
+1
View File
@@ -18,6 +18,7 @@
Просмотре), а меню телефона остаётся прежним и показывает их только в Просмотре), а меню телефона остаётся прежним и показывает их только в
Просмотре. Escape теперь выходит из любого редактора, предварительно закрыв Просмотре. Escape теперь выходит из любого редактора, предварительно закрыв
активный инструмент, выбор, перетаскивание, меню или диалог активный инструмент, выбор, перетаскивание, меню или диалог
без скачка высоты плана при появлении или скрытии панели инструментов
([#660](https://github.com/Matysh/houseplan-card/issues/660)). ([#660](https://github.com/Matysh/houseplan-card/issues/660)).
- При холодной загрузке дашборда включённый объёмный план (2.5D) больше не - При холодной загрузке дашборда включённый объёмный план (2.5D) больше не
успевает показать обычный плоский вид и не считает все полы тёмными на первом успевает показать обычный плоский вид и не считает все полы тёмными на первом
+12 -12
View File
@@ -3,7 +3,7 @@
"fixture": "synthetic-only", "fixture": "synthetic-only",
"chromium": "151.0.7922.34", "chromium": "151.0.7922.34",
"oxipng": null, "oxipng": null,
"sourceFingerprint": "39601d8b1eec460782b8cbfc1506ad0dfc65da5bcce580314a93af30790402ed", "sourceFingerprint": "9ae61c23df8295028939cdda1cd01e366d206ef5b856490bc2ea83aacf4d2588",
"captureScriptSha256": "e2d14d89de793011615662af7c83c433768d4761f6cec7f0b3860c797494299e", "captureScriptSha256": "e2d14d89de793011615662af7c83c433768d4761f6cec7f0b3860c797494299e",
"command": "npm run build && node demo/docs/capture.mjs", "command": "npm run build && node demo/docs/capture.mjs",
"scenarios": { "scenarios": {
@@ -15,7 +15,7 @@
}, },
"theme": "dark", "theme": "dark",
"language": "en", "language": "en",
"sourceSha256": "39601d8b1eec460782b8cbfc1506ad0dfc65da5bcce580314a93af30790402ed", "sourceSha256": "9ae61c23df8295028939cdda1cd01e366d206ef5b856490bc2ea83aacf4d2588",
"imageSha256": "1bde1bff8d4ab5f197320b54ef57186b3c07cf2121d5414ada63ce357826bfa8" "imageSha256": "1bde1bff8d4ab5f197320b54ef57186b3c07cf2121d5414ada63ce357826bfa8"
}, },
"view-touch": { "view-touch": {
@@ -26,7 +26,7 @@
}, },
"theme": "dark", "theme": "dark",
"language": "en", "language": "en",
"sourceSha256": "39601d8b1eec460782b8cbfc1506ad0dfc65da5bcce580314a93af30790402ed", "sourceSha256": "9ae61c23df8295028939cdda1cd01e366d206ef5b856490bc2ea83aacf4d2588",
"imageSha256": "f9dd5b54f86b814c00bc84149af84485f052b103cdcc9263b5c50bf5d32c69d6" "imageSha256": "f9dd5b54f86b814c00bc84149af84485f052b103cdcc9263b5c50bf5d32c69d6"
}, },
"space-create": { "space-create": {
@@ -37,7 +37,7 @@
}, },
"theme": "dark", "theme": "dark",
"language": "en", "language": "en",
"sourceSha256": "39601d8b1eec460782b8cbfc1506ad0dfc65da5bcce580314a93af30790402ed", "sourceSha256": "9ae61c23df8295028939cdda1cd01e366d206ef5b856490bc2ea83aacf4d2588",
"imageSha256": "aab4811bba3afa6cc849cb9d3989d126b8c327b69a2f8f853e55fc077e0e9a1b" "imageSha256": "aab4811bba3afa6cc849cb9d3989d126b8c327b69a2f8f853e55fc077e0e9a1b"
}, },
"room-contour-close": { "room-contour-close": {
@@ -48,7 +48,7 @@
}, },
"theme": "dark", "theme": "dark",
"language": "en", "language": "en",
"sourceSha256": "39601d8b1eec460782b8cbfc1506ad0dfc65da5bcce580314a93af30790402ed", "sourceSha256": "9ae61c23df8295028939cdda1cd01e366d206ef5b856490bc2ea83aacf4d2588",
"imageSha256": "e106ff9db6c96adb08beba12cc299a88ac5fa47c079be316f185e5657bc656f0" "imageSha256": "e106ff9db6c96adb08beba12cc299a88ac5fa47c079be316f185e5657bc656f0"
}, },
"plan-context-tray": { "plan-context-tray": {
@@ -59,7 +59,7 @@
}, },
"theme": "dark", "theme": "dark",
"language": "en", "language": "en",
"sourceSha256": "39601d8b1eec460782b8cbfc1506ad0dfc65da5bcce580314a93af30790402ed", "sourceSha256": "9ae61c23df8295028939cdda1cd01e366d206ef5b856490bc2ea83aacf4d2588",
"imageSha256": "9b0db923fa7c8aff783b5c7050ee5b410b1b04df81a9e48bbc8111a7d0d47e76" "imageSha256": "9b0db923fa7c8aff783b5c7050ee5b410b1b04df81a9e48bbc8111a7d0d47e76"
}, },
"device-editor": { "device-editor": {
@@ -70,7 +70,7 @@
}, },
"theme": "dark", "theme": "dark",
"language": "en", "language": "en",
"sourceSha256": "39601d8b1eec460782b8cbfc1506ad0dfc65da5bcce580314a93af30790402ed", "sourceSha256": "9ae61c23df8295028939cdda1cd01e366d206ef5b856490bc2ea83aacf4d2588",
"imageSha256": "198c084c0a45aa3afdf79181b80d8bb0347c95f3248b4fac9e05d69eb8a35f8f" "imageSha256": "198c084c0a45aa3afdf79181b80d8bb0347c95f3248b4fac9e05d69eb8a35f8f"
}, },
"device-display-preview": { "device-display-preview": {
@@ -81,7 +81,7 @@
}, },
"theme": "dark", "theme": "dark",
"language": "en", "language": "en",
"sourceSha256": "39601d8b1eec460782b8cbfc1506ad0dfc65da5bcce580314a93af30790402ed", "sourceSha256": "9ae61c23df8295028939cdda1cd01e366d206ef5b856490bc2ea83aacf4d2588",
"imageSha256": "e9b88d65dca74133646aa849d47bc09ad85eb8b16a168c4df6930e8f5856b5f5" "imageSha256": "e9b88d65dca74133646aa849d47bc09ad85eb8b16a168c4df6930e8f5856b5f5"
}, },
"background-editor": { "background-editor": {
@@ -92,7 +92,7 @@
}, },
"theme": "dark", "theme": "dark",
"language": "en", "language": "en",
"sourceSha256": "39601d8b1eec460782b8cbfc1506ad0dfc65da5bcce580314a93af30790402ed", "sourceSha256": "9ae61c23df8295028939cdda1cd01e366d206ef5b856490bc2ea83aacf4d2588",
"imageSha256": "44beadd61365ac1730c1efde846e528bfe92d8935fd167f1b6bf3bbad6af8f33" "imageSha256": "44beadd61365ac1730c1efde846e528bfe92d8935fd167f1b6bf3bbad6af8f33"
}, },
"room-card": { "room-card": {
@@ -103,7 +103,7 @@
}, },
"theme": "dark", "theme": "dark",
"language": "en", "language": "en",
"sourceSha256": "39601d8b1eec460782b8cbfc1506ad0dfc65da5bcce580314a93af30790402ed", "sourceSha256": "9ae61c23df8295028939cdda1cd01e366d206ef5b856490bc2ea83aacf4d2588",
"imageSha256": "d47988b03e6a078508b27b5612b6eafe8ecc33c891b589ddda1cc7c71f43b7c8" "imageSha256": "d47988b03e6a078508b27b5612b6eafe8ecc33c891b589ddda1cc7c71f43b7c8"
}, },
"device-info": { "device-info": {
@@ -114,7 +114,7 @@
}, },
"theme": "dark", "theme": "dark",
"language": "en", "language": "en",
"sourceSha256": "39601d8b1eec460782b8cbfc1506ad0dfc65da5bcce580314a93af30790402ed", "sourceSha256": "9ae61c23df8295028939cdda1cd01e366d206ef5b856490bc2ea83aacf4d2588",
"imageSha256": "4ec8c6df671742b90ca55222917076c47c5035a6df0587282e60873c0ce5f64e" "imageSha256": "4ec8c6df671742b90ca55222917076c47c5035a6df0587282e60873c0ce5f64e"
}, },
"pdf-export": { "pdf-export": {
@@ -125,7 +125,7 @@
}, },
"theme": "light", "theme": "light",
"language": "en", "language": "en",
"sourceSha256": "39601d8b1eec460782b8cbfc1506ad0dfc65da5bcce580314a93af30790402ed", "sourceSha256": "9ae61c23df8295028939cdda1cd01e366d206ef5b856490bc2ea83aacf4d2588",
"imageSha256": "ad3d735135b180ce015c9cda07fdcec08d7c8707abe0665734ef7b450a8a7093" "imageSha256": "ad3d735135b180ce015c9cda07fdcec08d7c8707abe0665734ef7b450a8a7093"
} }
}, },
+7 -4
View File
@@ -1344,10 +1344,13 @@ export class HouseplanCard extends LitElement {
} }
const inner = this.renderRoot.querySelector('.editorchrome-inner') as HTMLElement | null; const inner = this.renderRoot.querySelector('.editorchrome-inner') as HTMLElement | null;
const targetChromeHeight = targetMode === 'view' ? 0 : inner?.scrollHeight || 0; const targetChromeHeight = targetMode === 'view' ? 0 : inner?.scrollHeight || 0;
// updateComplete guarantees that this stage already belongs to the rendered ha-card. // The hidden measurement frame deliberately keeps the painted source
const containerOwnedHeight = this._containerOwnedHeight; // chrome/stage coordinates inline. Measuring stage.top here therefore
const targetStageHeight = Math.max(1, (containerOwnedHeight ? this.clientHeight : innerHeight) // still reports the source header, not the incoming editor chrome. The
- measuredCardHeaderHeight(this.renderRoot, this._stageEl!, containerOwnedHeight)!); // shared controller owns a constant stage + editor-chrome budget, so
// derive the target from that budget and let each RAF move both edges.
const targetStageHeight = Math.max(1,
from.stageHeight + from.editorChromeHeight - targetChromeHeight);
const targetStageWidth = this._stageEl?.clientWidth || from.stageWidth; const targetStageWidth = this._stageEl?.clientWidth || from.stageWidth;
const targetView = this._viewForModeTarget( const targetView = this._viewForModeTarget(
targetZoom, targetCenterX, targetCenterY, targetStageWidth, targetStageHeight, targetZoom, targetCenterX, targetCenterY, targetStageWidth, targetStageHeight,