Skip to content

Commit

Permalink
send correct props when calculating gallery position (#1289)
Browse files Browse the repository at this point in the history
  • Loading branch information
Galpittel authored Sep 18, 2024
1 parent ede6499 commit ffe3c96
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions packages/gallery/src/components/gallery/proGallery/slideshowView.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,20 +99,20 @@ class SlideshowView extends React.Component {
return false;
}
return (
this.isAllItemsLoaded() &&
this.scrollPositionAtTheAndOfTheGallery() >=
this.isAllItemsLoaded(props) &&
this.scrollPositionAtTheAndOfTheGallery(props) >=
Math.floor(this.getScrollElementWidth(props))
);
}

isAllItemsLoaded() {
isAllItemsLoaded(props = this.props) {
const {
totalItemsCount,
getVisibleItems,
galleryStructure,
container,
isPrerenderMode,
} = this.props;
} = props;
const visibleItemsCount = getVisibleItems(
galleryStructure.galleryItems,
container,
Expand Down Expand Up @@ -1100,20 +1100,20 @@ class SlideshowView extends React.Component {
};
}

getScrollPosition() {
return this.scrollElement ? this.scrollPosition() : 0;
getScrollPosition(props = this.props) {
return this.scrollElement ? this.scrollPosition(props) : 0;
}

scrollPositionAtTheMiddleOfTheGallery() {
return this.getScrollPosition() + this.props.container.galleryWidth / 2;
}

scrollPositionAtTheAndOfTheGallery() {
return this.getScrollPosition() + this.props.container.galleryWidth;
scrollPositionAtTheAndOfTheGallery(props = this.props) {
return this.getScrollPosition(props) + props.container.galleryWidth;
}

scrollPosition() {
return (this.props.options.isRTL ? -1 : 1) * this.scrollElement.scrollLeft;
scrollPosition(props = this.props) {
return (props.options.isRTL ? -1 : 1) * this.scrollElement.scrollLeft;
}

//-----------------------------------------| REACT |--------------------------------------------//
Expand Down

0 comments on commit ffe3c96

Please sign in to comment.