Skip to content

Commit

Permalink
Bug fix - Show all relevant thumbnails (#1272)
Browse files Browse the repository at this point in the history
* fix highlighted thumbnail calc

* show all relevant thumbnails according to the cur activeIndex
  • Loading branch information
Galpittel authored Aug 15, 2024
1 parent afd5a87 commit ab128f4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 2 additions & 1 deletion packages/gallery/src/components/helpers/thumbnailsLogic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ab128f4

Please sign in to comment.