adjusting
This commit is contained in:
parent
bd9391f401
commit
edf1a478f7
@ -173,6 +173,7 @@ open class CarouselIndicator: Control, CarouselPageControlProtocol {
|
||||
get { return _currentIndicatorColor }
|
||||
set (newColor) {
|
||||
_currentIndicatorColor = newColor
|
||||
carouselIndicatorModel?.currentIndicatorColor = Color(uiColor: newColor)
|
||||
|
||||
if isBarIndicator() {
|
||||
if let barIndicator = indicatorView as? BarsIndicatorView {
|
||||
@ -235,6 +236,9 @@ open class CarouselIndicator: Control, CarouselPageControlProtocol {
|
||||
let leftSwipe = UISwipeGestureRecognizer(target: self, action: #selector(swipeLeft))
|
||||
let rightSwipe = UISwipeGestureRecognizer(target: self, action: #selector(swipeRight))
|
||||
|
||||
leftSwipe.direction = .left
|
||||
rightSwipe.direction = .right
|
||||
|
||||
addGestureRecognizer(tap)
|
||||
addGestureRecognizer(leftSwipe)
|
||||
addGestureRecognizer(rightSwipe)
|
||||
|
||||
@ -14,27 +14,26 @@ public class CarouselIndicatorModel: CarouselPagingModelProtocol {
|
||||
// MARK: - Properties
|
||||
//--------------------------------------------------
|
||||
|
||||
public var backgroundColor: Color?
|
||||
|
||||
public static var identifier: String {
|
||||
return "carouselIndicator"
|
||||
}
|
||||
|
||||
public var backgroundColor: Color?
|
||||
public var moleculeName: String?
|
||||
public var type: String? = "hybrid"
|
||||
public var type: String = "hybrid"
|
||||
public var hybridThreshold: Int = 5
|
||||
public var barsColor: Color?
|
||||
public var currentBarColor: Color?
|
||||
public var currentIndex: Int? = 0
|
||||
public var numberOfPages: Int? = 0
|
||||
public var alwaysSendEvent: Bool? = false
|
||||
public var isAnimated: Bool? = true
|
||||
public var hidesForSinglePage: Bool? = false
|
||||
public var accessibilityHasSlidesInsteadOfPage: Bool? = false
|
||||
public var isEnabled: Bool? = false
|
||||
public var disabledIndicatorColor: Color? = Color(uiColor: .mvmCoolGray3)
|
||||
public var indicatorTintColor: Color? = Color(uiColor: .mvmBlack)
|
||||
public var currentIndicatorColor: Color? = Color(uiColor: .mvmBlack)
|
||||
public var currentIndex: Int = 0
|
||||
public var numberOfPages: Int = 0
|
||||
public var alwaysSendEvent: Bool = false
|
||||
public var isAnimated: Bool = true
|
||||
public var hidesForSinglePage: Bool = false
|
||||
public var accessibilityHasSlidesInsteadOfPage: Bool = false
|
||||
public var isEnabled: Bool = false
|
||||
public var disabledIndicatorColor: Color = Color(uiColor: .mvmCoolGray3)
|
||||
public var indicatorTintColor: Color = Color(uiColor: .mvmBlack)
|
||||
public var currentIndicatorColor: Color = Color(uiColor: .mvmBlack)
|
||||
public var position: Float?
|
||||
|
||||
//--------------------------------------------------
|
||||
@ -70,20 +69,56 @@ public class CarouselIndicatorModel: CarouselPagingModelProtocol {
|
||||
currentBarColor = try typeContainer.decodeIfPresent(Color.self, forKey: .currentBarColor)
|
||||
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
||||
barsColor = try typeContainer.decodeIfPresent(Color.self, forKey: .barsColor)
|
||||
type = try typeContainer.decodeIfPresent(String.self, forKey: .type) ?? "hybrid"
|
||||
hybridThreshold = try typeContainer.decodeIfPresent(Int.self, forKey: .hybridThreshold) ?? 5
|
||||
barsColor = try typeContainer.decodeIfPresent(Color.self, forKey: .barsColor)
|
||||
currentBarColor = try typeContainer.decodeIfPresent(Color.self, forKey: .currentBarColor)
|
||||
currentIndex = try typeContainer.decodeIfPresent(Int.self, forKey: .currentIndex) ?? 0
|
||||
numberOfPages = try typeContainer.decodeIfPresent(Int.self, forKey: .numberOfPages) ?? 0
|
||||
alwaysSendEvent = try typeContainer.decodeIfPresent(Bool.self, forKey: .alwaysSendEvent) ?? false
|
||||
isAnimated = try typeContainer.decodeIfPresent(Bool.self, forKey: .isAnimated) ?? true
|
||||
hidesForSinglePage = try typeContainer.decodeIfPresent(Bool.self, forKey: .hidesForSinglePage) ?? false
|
||||
accessibilityHasSlidesInsteadOfPage = try typeContainer.decodeIfPresent(Bool.self, forKey: .accessibilityHasSlidesInsteadOfPage) ?? false
|
||||
isEnabled = try typeContainer.decodeIfPresent(Bool.self, forKey: .isEnabled) ?? false
|
||||
disabledIndicatorColor = try typeContainer.decodeIfPresent(Color.self, forKey: .disabledIndicatorColor) ?? Color(uiColor: .mvmCoolGray3)
|
||||
indicatorTintColor = try typeContainer.decodeIfPresent(Color.self, forKey: .indicatorTintColor) ?? Color(uiColor: .mvmBlack)
|
||||
currentIndicatorColor = try typeContainer.decodeIfPresent(Color.self, forKey: .currentIndicatorColor) ?? Color(uiColor: .mvmBlack)
|
||||
|
||||
if let type = try typeContainer.decodeIfPresent(String.self, forKey: .type) {
|
||||
self.type = type
|
||||
}
|
||||
|
||||
if let hybridThreshold = try typeContainer.decodeIfPresent(Int.self, forKey: .hybridThreshold) {
|
||||
self.hybridThreshold = hybridThreshold
|
||||
}
|
||||
|
||||
if let currentIndex = try typeContainer.decodeIfPresent(Int.self, forKey: .currentIndex) {
|
||||
self.currentIndex = currentIndex
|
||||
}
|
||||
|
||||
if let numberOfPages = try typeContainer.decodeIfPresent(Int.self, forKey: .numberOfPages) {
|
||||
self.numberOfPages = numberOfPages
|
||||
}
|
||||
|
||||
if let alwaysSendEvent = try typeContainer.decodeIfPresent(Bool.self, forKey: .alwaysSendEvent) {
|
||||
self.alwaysSendEvent = alwaysSendEvent
|
||||
}
|
||||
|
||||
if let isAnimated = try typeContainer.decodeIfPresent(Bool.self, forKey: .isAnimated) {
|
||||
self.isAnimated = isAnimated
|
||||
}
|
||||
|
||||
if let hidesForSinglePage = try typeContainer.decodeIfPresent(Bool.self, forKey: .hidesForSinglePage) {
|
||||
self.hidesForSinglePage = hidesForSinglePage
|
||||
}
|
||||
|
||||
if let accessibilityHasSlidesInsteadOfPage = try typeContainer.decodeIfPresent(Bool.self, forKey: .accessibilityHasSlidesInsteadOfPage) {
|
||||
self.accessibilityHasSlidesInsteadOfPage = accessibilityHasSlidesInsteadOfPage
|
||||
}
|
||||
|
||||
if let isEnabled = try typeContainer.decodeIfPresent(Bool.self, forKey: .isEnabled) {
|
||||
self.isEnabled = isEnabled
|
||||
}
|
||||
|
||||
if let disabledIndicatorColor = try typeContainer.decodeIfPresent(Color.self, forKey: .disabledIndicatorColor) {
|
||||
self.disabledIndicatorColor = disabledIndicatorColor
|
||||
}
|
||||
|
||||
if let indicatorTintColor = try typeContainer.decodeIfPresent(Color.self, forKey: .indicatorTintColor) {
|
||||
self.indicatorTintColor = indicatorTintColor
|
||||
}
|
||||
|
||||
if let currentIndicatorColor = try typeContainer.decodeIfPresent(Color.self, forKey: .currentIndicatorColor) {
|
||||
self.currentIndicatorColor = currentIndicatorColor
|
||||
}
|
||||
}
|
||||
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
|
||||
@ -69,10 +69,9 @@ open class BarsIndicatorView: View, IndicatorViewProtocol {
|
||||
isUserInteractionEnabled = false
|
||||
|
||||
heightAnchor.constraint(equalToConstant: 4).isActive = true
|
||||
|
||||
stackView.centerXAnchor.constraint(equalTo: centerXAnchor).isActive = true
|
||||
stackView.leadingAnchor.constraint(greaterThanOrEqualTo: leadingAnchor).isActive = true
|
||||
trailingAnchor.constraint(greaterThanOrEqualTo: stackView.trailingAnchor).isActive = true
|
||||
stackView.leadingAnchor.constraint(equalTo: leadingAnchor).isActive = true
|
||||
trailingAnchor.constraint(equalTo: stackView.trailingAnchor).isActive = true
|
||||
}
|
||||
|
||||
//--------------------------------------------------
|
||||
|
||||
@ -226,8 +226,9 @@ open class Carousel: View {
|
||||
open func addPaging(view: (UIView & CarouselPageControlProtocol)?, position: CGFloat) {
|
||||
|
||||
pagingView?.removeFromSuperview()
|
||||
bottomPin?.isActive = false
|
||||
|
||||
guard var pagingView = view else {
|
||||
bottomPin?.isActive = false
|
||||
bottomPin = bottomAnchor.constraint(equalTo: collectionView.bottomAnchor)
|
||||
bottomPin?.isActive = true
|
||||
return
|
||||
@ -236,8 +237,6 @@ open class Carousel: View {
|
||||
addSubview(pagingView)
|
||||
pagingView.centerXAnchor.constraint(equalTo: collectionView.centerXAnchor).isActive = true
|
||||
collectionView.bottomAnchor.constraint(equalTo: pagingView.bottomAnchor, constant: position).isActive = true
|
||||
bottomAnchor.constraint(greaterThanOrEqualTo: pagingView.bottomAnchor).isActive = true
|
||||
bottomPin?.isActive = false
|
||||
bottomPin = bottomAnchor.constraint(equalTo: collectionView.bottomAnchor)
|
||||
bottomPin?.priority = .defaultLow
|
||||
bottomPin?.isActive = true
|
||||
|
||||
Loading…
Reference in New Issue
Block a user