From 4de5b30b603b3db4072f7f31e2ea865dcdbf49c0 Mon Sep 17 00:00:00 2001 From: Alexey Gryzin <62965405+feelsbadmans@users.noreply.github.com> Date: Mon, 9 Oct 2023 15:35:25 +0300 Subject: [PATCH] fix: fixed pagination infinity pages (#166) Co-authored-by: Alexey Gryzin --- src/YagrCore/plugins/legend/legend.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/YagrCore/plugins/legend/legend.ts b/src/YagrCore/plugins/legend/legend.ts index 4ac5a16f..c06b83f4 100644 --- a/src/YagrCore/plugins/legend/legend.ts +++ b/src/YagrCore/plugins/legend/legend.ts @@ -481,7 +481,7 @@ export default class LegendPlugin { const itemsRowsPerPage = rowsPerPage - 1; const itemsPageSize = Math.min(itemsRowsPerPage * rowHeight, maxPossiblePlace); const paginatedPageSize = Math.min(rowsPerPage * rowHeight, maxPossiblePlace); - const paginated = requiredHeight > itemsPageSize; + const paginated = requiredHeight > itemsPageSize && itemsPageSize > 0; const requiredSpace = Math.min(paginated ? paginatedPageSize : itemsPageSize, requiredHeight); const pages = Math.ceil(requiredHeight / itemsPageSize); const additionalSpace = paginated ? this.VERTICAL_PADDING + PAGINATION_BUTTON_HEIGHT : this.VERTICAL_PADDING;