diff --git a/ui_server.py b/ui_server.py index 4226f07..a93f578 100644 --- a/ui_server.py +++ b/ui_server.py @@ -2225,13 +2225,19 @@ HTML = """ function configTemplateKey(block) { return block.dataset.custom === 'true' ? (block.dataset.template || 'source') : block.dataset.section; } + function canvasViewportFloor(canvas, fallback) { + if (!canvas) return fallback; + const top = Math.max(0, canvas.getBoundingClientRect().top); + return Math.max(fallback, Math.ceil(window.innerHeight - top + 12)); + } function updateConfigCanvasHeight() { if (!configCanvas) return; const bottom = configBlocks.reduce((value, block) => { if (configBlockState(block)) return value; return Math.max(value, (block.offsetTop || 0) + block.offsetHeight); }, 0); - configCanvas.style.minHeight = `${Math.max(window.innerWidth <= 760 ? 900 : 760, bottom + 28)}px`; + const floor = canvasViewportFloor(configCanvas, window.innerWidth <= 760 ? 900 : 760); + configCanvas.style.minHeight = `${Math.max(floor, bottom + 28)}px`; } function fitConfigBlockContent(block) { if (!block || configBlockState(block) || block._configManualHeight) return false; @@ -3048,7 +3054,8 @@ HTML = """ function updateNetworkCanvasHeight() { if (!networkCanvas) return; const bottom = networkBlocks.reduce((value, block) => networkState(block) ? value : Math.max(value, (block.offsetTop || 0) + block.offsetHeight), 0); - networkCanvas.style.minHeight = `${Math.max(window.innerWidth <= 760 ? 900 : 720, bottom + 28)}px`; + const floor = canvasViewportFloor(networkCanvas, window.innerWidth <= 760 ? 900 : 720); + networkCanvas.style.minHeight = `${Math.max(floor, bottom + 28)}px`; } function applyNetworkLayout() { if (!networkCanvas) return;