From 22c72695add6bbd8f140ac18979d6d9e68f3c836 Mon Sep 17 00:00:00 2001 From: ShikiSuen Date: Wed, 16 Feb 2022 11:23:46 +0800 Subject: [PATCH] Voltaire // Fix Counting Error in Page Cycling. --- .../UI/CandidateUI/HorizontalCandidateController.swift | 10 ++++++---- .../UI/CandidateUI/VerticalCandidateController.swift | 10 ++++++---- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/Source/UI/CandidateUI/HorizontalCandidateController.swift b/Source/UI/CandidateUI/HorizontalCandidateController.swift index 8419a16b..a6494bb7 100644 --- a/Source/UI/CandidateUI/HorizontalCandidateController.swift +++ b/Source/UI/CandidateUI/HorizontalCandidateController.swift @@ -260,10 +260,11 @@ public class HorizontalCandidateController: CandidateController { } if currentPage + 1 >= pageCount { - currentPage = 1 + currentPage = 0 + } else { + currentPage += 1 } - currentPage += 1 candidateView.highlightedIndex = 0 layoutCandidateView() return true @@ -275,10 +276,11 @@ public class HorizontalCandidateController: CandidateController { } if currentPage == 0 { - currentPage = pageCount + currentPage = pageCount - 1 + } else { + currentPage -= 1 } - currentPage -= 1 candidateView.highlightedIndex = 0 layoutCandidateView() return true diff --git a/Source/UI/CandidateUI/VerticalCandidateController.swift b/Source/UI/CandidateUI/VerticalCandidateController.swift index e2432248..05a9b4dd 100644 --- a/Source/UI/CandidateUI/VerticalCandidateController.swift +++ b/Source/UI/CandidateUI/VerticalCandidateController.swift @@ -266,10 +266,11 @@ public class VerticalCandidateController: CandidateController { } if currentPage + 1 >= pageCount { - currentPage = 1 + currentPage = 0 + } else { + currentPage += 1 } - currentPage += 1 candidateView.highlightedIndex = 0 layoutCandidateView() return true @@ -281,10 +282,11 @@ public class VerticalCandidateController: CandidateController { } if currentPage == 0 { - currentPage = pageCount + currentPage = pageCount - 1 + } else { + currentPage -= 1 } - currentPage -= 1 candidateView.highlightedIndex = 0 layoutCandidateView() return true