fix: dock position uses real (post-clamp) window size, not requested canon

This commit is contained in:
Hermes Agent committed 2026-09-10 13:40:34 +02:00
1 parent 6901c5e0cd
commit 6624805449
2 files changed
+41 -11

No files matched your search

+17 -3
View File
@@ -243,12 +243,26 @@ function Plugin () {
| 'bottom-left' | 'bottom-center' | 'bottom-right'
function dockWindow (position: DockPosition) {
// Этап 1: просим main растянуть (попытка до канона) и запомнить режим.
// main НЕ позиционирует сразу — позиция считается на этапе 2 от РЕАЛЬНОГО
// размера, который Figma отрисует после клампа (видимый UI режет запрос).
emit('DOCK_WINDOW', {
position,
width: currentWindowSize.width,
height: currentWindowSize.height
width: window.innerWidth,
height: window.innerHeight
})
// Этап 2: через 2 кадра Figma уже применила resize и кламп — читаем реальный
// размер из iframe и шлём на точную прижимку (reposition от реального размера).
requestAnimationFrame(function () {
requestAnimationFrame(function () {
emit('DOCK_REFINE', {
position,
width: window.innerWidth,
height: window.innerHeight
})
refreshInfo()
})
})
refreshInfo()
}
const max = windowInfo != null ? windowInfo.maxViewport : null