Skip to content

Commit

Permalink
PR comment (rename)
Browse files Browse the repository at this point in the history
  • Loading branch information
noam-heller1 committed Nov 30, 2023
1 parent 125059b commit b3ee31a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -434,20 +434,19 @@ class SlideshowView extends React.Component {
}
};

findFirstIdx(itemIdx) {
getFirstIdx(itemIdx) {
const activeItem = this.props.galleryStructure.galleryItems[itemIdx];
const itemId = activeItem.itemId;
const firstItemInstance = this.props.galleryStructure.galleryItems.find((item) => item.itemId === itemId);
const firstItemInstanceIdx = firstItemInstance.idx;
return firstItemInstanceIdx;
const activeItemId = activeItem.itemId;
const firstItemInstance = this.props.galleryStructure.galleryItems.find((item) => item.itemId === activeItemId);
return firstItemInstance.idx;
}

scrollToThumbnail(itemIdx, scrollDuration) {
//not to confuse with this.props.actions.scrollToItem. this is used to replace it only for thumbnail items

this.props.actions.eventsListener(GALLERY_CONSTS.events.THUMBNAIL_CLICKED, this.props);
const activeItemFirstIdx = this.findFirstIdx(this.state.activeIndex);
const firstTargetItemIdx = this.findFirstIdx(itemIdx);
const activeItemFirstIdx = this.getFirstIdx(this.state.activeIndex);
const firstTargetItemIdx = this.getFirstIdx(itemIdx);
const distance = firstTargetItemIdx - activeItemFirstIdx;
const targetIdx = this.state.activeIndex + distance;

Expand Down
6 changes: 3 additions & 3 deletions packages/lib/src/core/helpers/thumbnailsLogic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ function getThumbnailsData({
height,
thumbnailSizeWithSpacing,
activeIndex: activeIndexWithOffset,
numberOfGalleryItems: galleryItems.length,
itemsCount: galleryItems.length,
});

const thumbnailsStyleWithRTLCalc = isRTL
Expand Down Expand Up @@ -194,14 +194,14 @@ function getThumbnailsStyles({
height,
activeIndex,
thumbnailSizeWithSpacing,
numberOfGalleryItems: numberOfItems,
itemsCount: numberOfItems,
}: {
horizontalThumbnails: boolean;
width: number;
height: number;
activeIndex: number;
thumbnailSizeWithSpacing: number;
numberOfGalleryItems: number;
itemsCount: number;
}): any {
const baseStyle = {
overflow: 'visible',
Expand Down

0 comments on commit b3ee31a

Please sign in to comment.