indicator changes

This commit is contained in:
Kevin G Christiano 2020-05-05 12:54:50 -04:00
parent 0aad6f3aa7
commit 89499d59ed

View File

@ -42,19 +42,24 @@ open class BarsIndicatorView: CarouselIndicator {
open override var isEnabled: Bool {
didSet {
barReferences.forEach { view, _ in
view.backgroundColor = isEnabled ? indicatorColor : disabledIndicatorColor
for (i, bar) in barReferences.enumerated() {
if i == currentIndex {
bar.view.backgroundColor = isEnabled ? currentIndicatorColor : disabledIndicatorColor
} else {
bar.view.backgroundColor = isEnabled ? indicatorColor : disabledIndicatorColor
}
}
}
}
/// Colors the currently selected index, unique from other indicators
public var currentIndicatorColor: UIColor {
get { return barsCarouselIndicatorModel?.currentIndicatorColor.uiColor ?? .mvmBlack }
get { return barsCarouselIndicatorModel?.currentIndicatorColor.uiColor ?? indicatorColor }
set (newColor) {
barsCarouselIndicatorModel?.currentIndicatorColor = Color(uiColor: newColor)
if !barReferences.isEmpty {
if isEnabled && !barReferences.isEmpty {
barReferences[currentIndex].view.backgroundColor = newColor
}
}