From ddd03eca1f6f4a7f000b02bfa048e34a73b36615 Mon Sep 17 00:00:00 2001 From: Mohammadreza Fallah Date: Tue, 29 Sep 2026 12:44:13 +0330 Subject: [PATCH] fix(canvas): prevent unnecessary page scrolling The canvas always reserved two extra grid rows, which caused vertical scrolling even when every widget fit inside the viewport. Only reserve the extra rows while the canvas is in edit mode. Normal mode now follows the actual widget height while preserving scroll for overflowing layouts. --- src/layouts/widgets/canvas/canvas.layout.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/layouts/widgets/canvas/canvas.layout.tsx b/src/layouts/widgets/canvas/canvas.layout.tsx index 8ddc6a859..f71f00a64 100644 --- a/src/layouts/widgets/canvas/canvas.layout.tsx +++ b/src/layouts/widgets/canvas/canvas.layout.tsx @@ -111,7 +111,8 @@ export function FreeWidgetCanvas() { 0, ...runtimeLayout.map((w) => w.position.row + w.size.h) ) - const totalGridRows = Math.max(6, maxWidgetRow + 2) + const contentGridRows = Math.max(6, maxWidgetRow) + const totalGridRows = canvasMode === 'edit' ? contentGridRows + 2 : contentGridRows const canvasPixelHeight = Math.max( totalGridRows * cellHeight + Math.max(0, totalGridRows - 1) * gap, getCanvasHeight(runtimeLayout, cellHeight, gap)