From 8e5f993cd83f753734264bddee9cc791ed7870bc Mon Sep 17 00:00:00 2001 From: tlartem Date: Mon, 28 Jul 2025 14:10:22 +0300 Subject: [PATCH] =?UTF-8?q?=D0=BF=D1=80=D0=BE=D0=BA=D1=80=D1=83=D1=82?= =?UTF-8?q?=D0=BA=D0=B0=20=D0=BF=D1=80=D0=B8=20=D1=81=D0=BE=D0=B7=D0=B4?= =?UTF-8?q?=D0=B0=D0=BD=D0=B8=D0=B8=20=D0=BF=D1=80=D0=BE=D1=82=D0=BE=D0=BA?= =?UTF-8?q?=D0=BE=D0=BB=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/page/ProtocolCreation/Page.tsx | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/src/page/ProtocolCreation/Page.tsx b/src/page/ProtocolCreation/Page.tsx index 386a775..55e85c1 100644 --- a/src/page/ProtocolCreation/Page.tsx +++ b/src/page/ProtocolCreation/Page.tsx @@ -199,14 +199,27 @@ const ProtocolForm: FC = ({ template, onSave, onBack }) => { } const canvasSize = useMemo(() => { - const PADDING_Y = 200 const baseWidth = 1200 - const baseHeight = 800 if (template.elements.length === 0) { - return { width: baseWidth, height: baseHeight } + return { width: baseWidth, height: 150 } // Совсем маленькая высота для пустых } + if (template.elements.length <= 2) { + // Для малого количества элементов - минимальные отступы + const contentHeight = Math.max( + 0, + ...template.elements.map( + el => (el.layout?.y || 0) + (el.layout?.height || 0) + ) + ) + return { + width: baseWidth, + height: Math.max(200, contentHeight + 30), // Очень маленькие отступы + } + } + + // Для большого количества элементов - обычные отступы const contentHeight = Math.max( 0, ...template.elements.map( @@ -216,7 +229,7 @@ const ProtocolForm: FC = ({ template, onSave, onBack }) => { return { width: baseWidth, - height: Math.max(baseHeight, contentHeight + PADDING_Y), + height: Math.max(300, contentHeight + 80), } }, [template.elements]) @@ -301,7 +314,7 @@ const ProtocolForm: FC = ({ template, onSave, onBack }) => { className={`${showSpreadsheet ? 'hidden' : 'block'} h-full overflow-auto`} >
{template.elements.map(element => {