Voltaire // Simplify the conditioning used for page looping.
This commit is contained in:
parent
23792e7162
commit
dab9714567
|
@ -255,40 +255,18 @@ public class HorizontalCandidateController: CandidateController {
|
||||||
}
|
}
|
||||||
|
|
||||||
public override func showNextPage() -> Bool {
|
public override func showNextPage() -> Bool {
|
||||||
guard delegate != nil else {
|
guard delegate != nil else {return false}
|
||||||
return false
|
if pageCount == 1 {return highlightNextCandidate()}
|
||||||
}
|
currentPage = (currentPage + 1 >= pageCount) ? 0 : currentPage + 1
|
||||||
|
|
||||||
if pageCount == 1 {
|
|
||||||
return highlightNextCandidate()
|
|
||||||
}
|
|
||||||
|
|
||||||
if currentPage + 1 >= pageCount {
|
|
||||||
currentPage = 0
|
|
||||||
} else {
|
|
||||||
currentPage += 1
|
|
||||||
}
|
|
||||||
|
|
||||||
candidateView.highlightedIndex = 0
|
candidateView.highlightedIndex = 0
|
||||||
layoutCandidateView()
|
layoutCandidateView()
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
public override func showPreviousPage() -> Bool {
|
public override func showPreviousPage() -> Bool {
|
||||||
guard delegate != nil else {
|
guard delegate != nil else {return false}
|
||||||
return false
|
if pageCount == 1 {return highlightPreviousCandidate()}
|
||||||
}
|
currentPage = (currentPage == 0) ? pageCount - 1 : currentPage - 1
|
||||||
|
|
||||||
if pageCount == 1 {
|
|
||||||
return highlightPreviousCandidate()
|
|
||||||
}
|
|
||||||
|
|
||||||
if currentPage == 0 {
|
|
||||||
currentPage = pageCount - 1
|
|
||||||
} else {
|
|
||||||
currentPage -= 1
|
|
||||||
}
|
|
||||||
|
|
||||||
candidateView.highlightedIndex = 0
|
candidateView.highlightedIndex = 0
|
||||||
layoutCandidateView()
|
layoutCandidateView()
|
||||||
return true
|
return true
|
||||||
|
|
|
@ -261,40 +261,18 @@ public class VerticalCandidateController: CandidateController {
|
||||||
}
|
}
|
||||||
|
|
||||||
public override func showNextPage() -> Bool {
|
public override func showNextPage() -> Bool {
|
||||||
guard delegate != nil else {
|
guard delegate != nil else {return false}
|
||||||
return false
|
if pageCount == 1 {return highlightNextCandidate()}
|
||||||
}
|
currentPage = (currentPage + 1 >= pageCount) ? 0 : currentPage + 1
|
||||||
|
|
||||||
if pageCount == 1 {
|
|
||||||
return highlightNextCandidate()
|
|
||||||
}
|
|
||||||
|
|
||||||
if currentPage + 1 >= pageCount {
|
|
||||||
currentPage = 0
|
|
||||||
} else {
|
|
||||||
currentPage += 1
|
|
||||||
}
|
|
||||||
|
|
||||||
candidateView.highlightedIndex = 0
|
candidateView.highlightedIndex = 0
|
||||||
layoutCandidateView()
|
layoutCandidateView()
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
public override func showPreviousPage() -> Bool {
|
public override func showPreviousPage() -> Bool {
|
||||||
guard delegate != nil else {
|
guard delegate != nil else {return false}
|
||||||
return false
|
if pageCount == 1 {return highlightPreviousCandidate()}
|
||||||
}
|
currentPage = (currentPage == 0) ? pageCount - 1 : currentPage - 1
|
||||||
|
|
||||||
if pageCount == 1 {
|
|
||||||
return highlightPreviousCandidate()
|
|
||||||
}
|
|
||||||
|
|
||||||
if currentPage == 0 {
|
|
||||||
currentPage = pageCount - 1
|
|
||||||
} else {
|
|
||||||
currentPage -= 1
|
|
||||||
}
|
|
||||||
|
|
||||||
candidateView.highlightedIndex = 0
|
candidateView.highlightedIndex = 0
|
||||||
layoutCandidateView()
|
layoutCandidateView()
|
||||||
return true
|
return true
|
||||||
|
|
Loading…
Reference in New Issue