Commit b1b8a380 by Torkel Ödegaard

refactor: renaming variables, refactoring PR #12796

parent 013f8cd8
...@@ -836,16 +836,16 @@ export class DashboardModel { ...@@ -836,16 +836,16 @@ export class DashboardModel {
return; return;
} }
let maxRows = Math.max( let currentGridHeight = Math.max(
...this.panels.map(panel => { ...this.panels.map(panel => {
return panel.gridPos.h + panel.gridPos.y; return panel.gridPos.h + panel.gridPos.y;
}) })
); );
//Consider navbar and submenu controls, padding and margin //Consider navbar and submenu controls, padding and margin
let availableHeight = window.innerHeight - 55 - 20; let visibleHeight = window.innerHeight - 55 - 20;
let availableRows = Math.floor(availableHeight / (GRID_CELL_HEIGHT + GRID_CELL_VMARGIN)); let visibleGridHeight = Math.floor(visibleHeight / (GRID_CELL_HEIGHT + GRID_CELL_VMARGIN));
let scaleFactor = maxRows / availableRows; let scaleFactor = currentGridHeight / visibleGridHeight;
this.panels.forEach((panel, i) => { this.panels.forEach((panel, i) => {
panel.gridPos.y = Math.round(panel.gridPos.y / scaleFactor) || 1; panel.gridPos.y = Math.round(panel.gridPos.y / scaleFactor) || 1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment