moving action to point of interaction

This commit is contained in:
Kevin G Christiano 2020-05-07 15:36:50 -04:00
parent ee107a25cf
commit fd3b08bc06
3 changed files with 7 additions and 26 deletions

View File

@ -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)
}
}
//--------------------------------------------------

View File

@ -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.

View File

@ -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
//--------------------------------------------------