Bugfix CXTDT-619833 - pagination fix
This commit is contained in:
parent
8212d7146c
commit
4dec2388ae
@ -111,7 +111,9 @@ open class Carousel: View {
|
|||||||
/// Updates if the pager is visible or not.
|
/// Updates if the pager is visible or not.
|
||||||
private func updatePagerVisibility() {
|
private func updatePagerVisibility() {
|
||||||
guard let pagingView = pagingView else { return }
|
guard let pagingView = pagingView else { return }
|
||||||
let shouldHidePager = collectionView.contentSize.width < bounds.width
|
// Consider hidesForSinglePage only if numberOfPages is less than 2
|
||||||
|
let hidePager = (numberOfPages < 2) ? ((pagingView.model as? CarouselPagingModelProtocol)?.hidesForSinglePage ?? true) : false
|
||||||
|
let shouldHidePager = (collectionView.contentSize.width < bounds.width) && hidePager
|
||||||
if (shouldHidePager && !pagingView.isHidden) || (!shouldHidePager && pagingView.isHidden) {
|
if (shouldHidePager && !pagingView.isHidden) || (!shouldHidePager && pagingView.isHidden) {
|
||||||
pagingView.isHidden = shouldHidePager
|
pagingView.isHidden = shouldHidePager
|
||||||
pagingBottomPin?.isActive = !shouldHidePager
|
pagingBottomPin?.isActive = !shouldHidePager
|
||||||
@ -491,6 +493,7 @@ extension Carousel: UICollectionViewDelegate {
|
|||||||
adjustedIndex = adjustedIndex + numberOfPages
|
adjustedIndex = adjustedIndex + numberOfPages
|
||||||
}
|
}
|
||||||
model.selectedIndex = adjustedIndex
|
model.selectedIndex = adjustedIndex
|
||||||
|
pagingView?.currentIndex = adjustedIndex
|
||||||
}
|
}
|
||||||
if let cell = collectionView.cellForItem(at: indexPath) as? CollectionTemplateItemProtocol {
|
if let cell = collectionView.cellForItem(at: indexPath) as? CollectionTemplateItemProtocol {
|
||||||
cell.didSelectCell(at: indexPath, delegateObject: delegateObject, additionalData: nil)
|
cell.didSelectCell(at: indexPath, delegateObject: delegateObject, additionalData: nil)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user