From 065d74db426fbce4cc6564bad1cc086729edf33b Mon Sep 17 00:00:00 2001 From: Devin Harris Date: Sun, 11 Sep 2022 13:37:27 -0400 Subject: [PATCH 1/2] fix(min-property-and-scroll-bug): width and height calculations off max of min and explicit property --- projects/angular-grid-layout/src/lib/grid.component.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/projects/angular-grid-layout/src/lib/grid.component.ts b/projects/angular-grid-layout/src/lib/grid.component.ts index 1619b1b..2d5549a 100644 --- a/projects/angular-grid-layout/src/lib/grid.component.ts +++ b/projects/angular-grid-layout/src/lib/grid.component.ts @@ -48,15 +48,15 @@ function layoutToRenderItems(config: KtdGridCfg, width: number, height: number): id: item.id, top: item.y === 0 ? 0 : item.y * rowHeight, left: item.x * (width / cols), - width: item.w * (width / cols), - height: item.h * rowHeight + width: Math.max(item.w, item.minW ?? 0) * (width / cols), + height: Math.max(item.h, item.minH ?? 0) * rowHeight }; } return renderItems; } function getGridHeight(layout: KtdGridLayout, rowHeight: number): number { - return layout.reduce((acc, cur) => Math.max(acc, (cur.y + cur.h) * rowHeight), 0); + return layout.reduce((acc, cur) => Math.max(acc, (cur.y + Math.max(cur.h, cur.minH ?? 0)) * rowHeight), 0); } // eslint-disable-next-line @katoid/prefix-exported-code From ad639e6503478ae1427838d636ff3dff3013762b Mon Sep 17 00:00:00 2001 From: Devin Harris Date: Sun, 11 Sep 2022 13:38:43 -0400 Subject: [PATCH 2/2] fix(min-property-and-scroll-bug): calculating render data after content fully initializes --- projects/angular-grid-layout/src/lib/grid.component.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/angular-grid-layout/src/lib/grid.component.ts b/projects/angular-grid-layout/src/lib/grid.component.ts index 2d5549a..572375d 100644 --- a/projects/angular-grid-layout/src/lib/grid.component.ts +++ b/projects/angular-grid-layout/src/lib/grid.component.ts @@ -254,6 +254,7 @@ export class KtdGridComponent implements OnChanges, AfterContentInit, AfterConte ngAfterContentInit() { this.initSubscriptions(); + this.calculateRenderData(); } ngAfterContentChecked() {