moving action to point of interaction
This commit is contained in:
parent
ee107a25cf
commit
fd3b08bc06
@ -134,6 +134,7 @@ open class BarsIndicatorView: CarouselIndicator {
|
||||
public override func assessTouchOf(_ touchPoint_X: CGFloat) {
|
||||
|
||||
currentIndex = barReferences.firstIndex { $0.0.frame.maxX >= touchPoint_X && $0.0.frame.minX <= touchPoint_X } ?? 0
|
||||
performAction()
|
||||
}
|
||||
|
||||
open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||
@ -142,14 +143,6 @@ open class BarsIndicatorView: CarouselIndicator {
|
||||
guard let model = model as? BarsCarouselIndicatorModel else { return }
|
||||
|
||||
currentIndicatorColor = model.currentIndicatorColor.uiColor
|
||||
|
||||
if barReferences.isEmpty {
|
||||
generateBars()
|
||||
updateUI(previousIndex: previousIndex,
|
||||
newIndex: currentIndex,
|
||||
totalCount: numberOfPages,
|
||||
isAnimated: false)
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------
|
||||
|
||||
@ -48,13 +48,10 @@ open class CarouselIndicator: Control, CarouselPageControlProtocol {
|
||||
previousIndex = currentIndex
|
||||
carouselIndicatorModel?.currentIndex = newIndex
|
||||
|
||||
if previousIndex != newIndex {
|
||||
updateUI(previousIndex: previousIndex,
|
||||
newIndex: newIndex,
|
||||
totalCount: numberOfPages,
|
||||
isAnimated: carouselIndicatorModel?.animated ?? true)
|
||||
performAction()
|
||||
}
|
||||
updateUI(previousIndex: previousIndex,
|
||||
newIndex: newIndex,
|
||||
totalCount: numberOfPages,
|
||||
isAnimated: carouselIndicatorModel?.animated ?? true)
|
||||
}
|
||||
}
|
||||
|
||||
@ -141,11 +138,13 @@ open class CarouselIndicator: Control, CarouselPageControlProtocol {
|
||||
|
||||
func incrementCurrentIndex() {
|
||||
currentIndex = (currentIndex + 1) % numberOfPages
|
||||
performAction()
|
||||
}
|
||||
|
||||
func decrementCurrentIndex() {
|
||||
let newIndex = currentIndex - 1
|
||||
currentIndex = newIndex < 0 ? numberOfPages - 1 : newIndex
|
||||
performAction()
|
||||
}
|
||||
|
||||
/// Increments the currentIndex value.
|
||||
|
||||
@ -113,17 +113,6 @@ open class NumericIndicatorView: CarouselIndicator {
|
||||
leftArrow.setNeedsDisplay()
|
||||
}
|
||||
|
||||
open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||
super.set(with: model, delegateObject, additionalData)
|
||||
|
||||
if pageCount.text?.isEmpty == nil {
|
||||
updateUI(previousIndex: previousIndex,
|
||||
newIndex: currentIndex,
|
||||
totalCount: numberOfPages,
|
||||
isAnimated: false)
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------
|
||||
// MARK: - IndicatorViewProtocol
|
||||
//--------------------------------------------------
|
||||
|
||||
Loading…
Reference in New Issue
Block a user