default dimension
This commit is contained in:
parent
76f39b3f22
commit
a03b50865f
@ -26,7 +26,7 @@ open class LoadingSpinner: View {
|
||||
|
||||
public var heightConstraint: NSLayoutConstraint?
|
||||
public var widthConstraint: NSLayoutConstraint?
|
||||
|
||||
|
||||
//--------------------------------------------------
|
||||
// MARK: - Lifecycle
|
||||
//--------------------------------------------------
|
||||
@ -39,6 +39,13 @@ open class LoadingSpinner: View {
|
||||
return CAShapeLayer.self
|
||||
}
|
||||
|
||||
open override func setupView() {
|
||||
super.setupView()
|
||||
|
||||
heightConstraint = heightAnchor.constraint(equalToConstant: 0)
|
||||
widthConstraint = widthAnchor.constraint(equalToConstant: 0)
|
||||
}
|
||||
|
||||
override open func layoutSubviews() {
|
||||
super.layoutSubviews()
|
||||
layer.fillColor = nil
|
||||
@ -172,8 +179,9 @@ open class LoadingSpinner: View {
|
||||
|
||||
func pinWidthAndHeight(diameter: CGFloat) {
|
||||
|
||||
heightConstraint = heightAnchor.constraint(equalToConstant: diameter + lineWidth)
|
||||
widthConstraint = widthAnchor.constraint(equalToConstant: diameter + lineWidth)
|
||||
let dimension = diameter + lineWidth
|
||||
heightConstraint?.constant = dimension
|
||||
widthConstraint?.constant = dimension
|
||||
heightConstraint?.isActive = true
|
||||
widthConstraint?.isActive = true
|
||||
}
|
||||
@ -188,10 +196,7 @@ open class LoadingSpinner: View {
|
||||
|
||||
strokeColor = model.strokeColor.uiColor
|
||||
lineWidth = model.lineWidth
|
||||
|
||||
if let diameter = model.diameter {
|
||||
pinWidthAndHeight(diameter: diameter)
|
||||
}
|
||||
pinWidthAndHeight(diameter: model.diameter ?? 40)
|
||||
}
|
||||
|
||||
open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user