From ab128f446d4e06799a7def48a3ab89865e671b0f Mon Sep 17 00:00:00 2001 From: Galpittel <95571398+Galpittel@users.noreply.github.com> Date: Thu, 15 Aug 2024 11:42:39 +0300 Subject: [PATCH] Bug fix - Show all relevant thumbnails (#1272) * fix highlighted thumbnail calc * show all relevant thumbnails according to the cur activeIndex --- .../src/components/gallery/proGallery/navigationPanel.js | 3 ++- packages/gallery/src/components/helpers/thumbnailsLogic.ts | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/gallery/src/components/gallery/proGallery/navigationPanel.js b/packages/gallery/src/components/gallery/proGallery/navigationPanel.js index 4ededecba..c8045f530 100644 --- a/packages/gallery/src/components/gallery/proGallery/navigationPanel.js +++ b/packages/gallery/src/components/gallery/proGallery/navigationPanel.js @@ -83,7 +83,8 @@ class NavigationPanel extends React.Component { style={{ ...thumbnailsStyle }} > {items.map(({ thumbnailItem, location, idx }) => { - const highlighted = idx === activeIndex % items.length; + const highlighted = + idx === activeIndex % clearedGalleryItems.length; const itemStyle = { width: thumbnailSize, height: thumbnailSize, diff --git a/packages/gallery/src/components/helpers/thumbnailsLogic.ts b/packages/gallery/src/components/helpers/thumbnailsLogic.ts index 2b3ba333b..c8f768bce 100644 --- a/packages/gallery/src/components/helpers/thumbnailsLogic.ts +++ b/packages/gallery/src/components/helpers/thumbnailsLogic.ts @@ -104,7 +104,8 @@ export function getThumbnailsData({ minNumOfThumbnails % 2 === 1 ? minNumOfThumbnails : minNumOfThumbnails + 1; const thumbnailsInEachSide = (numberOfThumbnails - 1) / 2; - const itemRangeStart = activeIndexWithOffset - thumbnailsInEachSide; + const itemRangeStart = + (activeIndexWithOffset % galleryItems.length) - thumbnailsInEachSide; const itemRangeEnd = itemRangeStart + numberOfThumbnails; const itemToDisplay = withInfiniteScroll