indicator changes
This commit is contained in:
parent
0aad6f3aa7
commit
89499d59ed
@ -42,19 +42,24 @@ open class BarsIndicatorView: CarouselIndicator {
|
|||||||
|
|
||||||
open override var isEnabled: Bool {
|
open override var isEnabled: Bool {
|
||||||
didSet {
|
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
|
/// Colors the currently selected index, unique from other indicators
|
||||||
public var currentIndicatorColor: UIColor {
|
public var currentIndicatorColor: UIColor {
|
||||||
get { return barsCarouselIndicatorModel?.currentIndicatorColor.uiColor ?? .mvmBlack }
|
get { return barsCarouselIndicatorModel?.currentIndicatorColor.uiColor ?? indicatorColor }
|
||||||
set (newColor) {
|
set (newColor) {
|
||||||
barsCarouselIndicatorModel?.currentIndicatorColor = Color(uiColor: newColor)
|
barsCarouselIndicatorModel?.currentIndicatorColor = Color(uiColor: newColor)
|
||||||
|
|
||||||
if !barReferences.isEmpty {
|
if isEnabled && !barReferences.isEmpty {
|
||||||
barReferences[currentIndex].view.backgroundColor = newColor
|
barReferences[currentIndex].view.backgroundColor = newColor
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user