Added temporary corner rounding
This commit is contained in:
parent
ca01fdb02e
commit
dcd4dde59d
@ -22,7 +22,8 @@ open class CarouselItem: MoleculeCollectionViewCell, CarouselItemProtocol {
|
||||
|
||||
open override func setupView() {
|
||||
super.setupView()
|
||||
|
||||
clipsToBounds = true
|
||||
|
||||
// Covers the card when peaking.
|
||||
peakingCover.backgroundColor = .white
|
||||
peakingCover.alpha = 0
|
||||
@ -51,6 +52,12 @@ open class CarouselItem: MoleculeCollectionViewCell, CarouselItemProtocol {
|
||||
super.set(with: model, delegateObject, additionalData)
|
||||
guard let collectionModel = model as? CarouselItemModel else { return }
|
||||
|
||||
if let cornerRadius = (model as? ContainerModel)?.cornerRadius {
|
||||
layer.cornerRadius = cornerRadius
|
||||
} else {
|
||||
layer.cornerRadius = 0
|
||||
}
|
||||
|
||||
// Handles peaking.
|
||||
allowsPeaking = collectionModel.peakingUI ?? false
|
||||
if let peakingArrowColor = collectionModel.peakingArrowColor {
|
||||
|
||||
@ -31,6 +31,11 @@ open class Container: View, ContainerProtocol {
|
||||
guard let containerModel = model as? ContainerModelProtocol else { return }
|
||||
|
||||
containerHelper.set(with: containerModel, for: view as? MVMCoreUIViewConstrainingProtocol)
|
||||
if let cornerRadius = (containerModel as? ContainerModel)?.cornerRadius {
|
||||
layer.cornerRadius = cornerRadius
|
||||
} else {
|
||||
layer.cornerRadius = 0
|
||||
}
|
||||
}
|
||||
|
||||
override open func reset() {
|
||||
|
||||
@ -23,6 +23,8 @@ open class ContainerModel: ContainerModelProtocol, Codable {
|
||||
public var topPadding: CGFloat?
|
||||
public var bottomPadding: CGFloat?
|
||||
|
||||
public var cornerRadius: CGFloat?
|
||||
|
||||
//--------------------------------------------------
|
||||
// MARK: - Keys
|
||||
//--------------------------------------------------
|
||||
@ -36,6 +38,7 @@ open class ContainerModel: ContainerModelProtocol, Codable {
|
||||
case useVerticalMargins
|
||||
case topPadding
|
||||
case bottomPadding
|
||||
case cornerRadius
|
||||
}
|
||||
|
||||
//--------------------------------------------------
|
||||
@ -83,6 +86,7 @@ open class ContainerModel: ContainerModelProtocol, Codable {
|
||||
useVerticalMargins = try typeContainer.decodeIfPresent(Bool.self, forKey: .useVerticalMargins)
|
||||
topPadding = try typeContainer.decodeIfPresent(CGFloat.self, forKey: .topPadding)
|
||||
bottomPadding = try typeContainer.decodeIfPresent(CGFloat.self, forKey: .bottomPadding)
|
||||
cornerRadius = try typeContainer.decodeIfPresent(CGFloat.self, forKey: .cornerRadius)
|
||||
setDefaults()
|
||||
}
|
||||
|
||||
@ -96,5 +100,6 @@ open class ContainerModel: ContainerModelProtocol, Codable {
|
||||
try container.encodeIfPresent(useVerticalMargins, forKey: .useVerticalMargins)
|
||||
try container.encodeIfPresent(topPadding, forKey: .topPadding)
|
||||
try container.encodeIfPresent(bottomPadding, forKey: .bottomPadding)
|
||||
try container.encodeIfPresent(cornerRadius, forKey: .cornerRadius)
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user