From 22043d787293f094ca931b898772b11c8e7d96f4 Mon Sep 17 00:00:00 2001 From: Ryan McKinley Date: Wed, 19 May 2021 08:42:45 -0700 Subject: [PATCH] Chore: improve the "Actual" size calculation (#34345) --- .../features/dashboard/components/PanelEditor/utils.ts | 9 ++++++--- public/app/features/live/dashboard/dashboardWatcher.ts | 1 - 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/public/app/features/dashboard/components/PanelEditor/utils.ts b/public/app/features/dashboard/components/PanelEditor/utils.ts index f0ab59bf0d2..52bd49416b4 100644 --- a/public/app/features/dashboard/components/PanelEditor/utils.ts +++ b/public/app/features/dashboard/components/PanelEditor/utils.ts @@ -9,12 +9,15 @@ export function calculatePanelSize(mode: DisplayMode, width: number, height: num if (mode === DisplayMode.Fill) { return { width, height }; } - const colWidth = (window.innerWidth - GRID_CELL_VMARGIN * 4) / GRID_COLUMN_COUNT; + const panelPadding = 8 * 6; + const sidebarWidth = 60; + + const colWidth = (window.innerWidth - sidebarWidth - GRID_CELL_VMARGIN * 4) / GRID_COLUMN_COUNT; const pWidth = colWidth * panel.gridPos.w; - const pHeight = GRID_CELL_HEIGHT * panel.gridPos.h; + const pHeight = GRID_CELL_HEIGHT * panel.gridPos.h + panelPadding; const scale = Math.min(width / pWidth, height / pHeight); - if (mode === DisplayMode.Exact && pWidth <= width && pHeight <= height) { + if (pWidth <= width && pHeight <= height) { return { width: pWidth, height: pHeight, diff --git a/public/app/features/live/dashboard/dashboardWatcher.ts b/public/app/features/live/dashboard/dashboardWatcher.ts index e8bf53ef365..4eaa1d85b9e 100644 --- a/public/app/features/live/dashboard/dashboardWatcher.ts +++ b/public/app/features/live/dashboard/dashboardWatcher.ts @@ -147,7 +147,6 @@ class DashboardWatcher { } } } - console.log('DashboardEvent EVENT', event); }, };