Chore: improve the "Actual" size calculation (#34345)

This commit is contained in:
Ryan McKinley 2021-05-19 08:42:45 -07:00 committed by GitHub
parent a2cbbe1b8a
commit 22043d7872
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 4 deletions

View File

@ -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,

View File

@ -147,7 +147,6 @@ class DashboardWatcher {
}
}
}
console.log('DashboardEvent EVENT', event);
},
};