Merge branch 'bugfix/progress_and_caret' into 'develop'

defect fixes

See merge request BPHV_MIPS/mvm_core_ui!242
This commit is contained in:
Pan, Xinlei (Ryan) 2020-02-04 12:12:28 -05:00
commit 2c613ebd09
2 changed files with 13 additions and 3 deletions

View File

@ -49,7 +49,9 @@ open class CaretButton: MFCustomButton, MVMCoreUIMoleculeViewProtocol, MVMCoreUI
didSet { changeCaretColor() }
}
public func updateView(_ size: CGFloat) { }
public func updateView(_ size: CGFloat) {
titleLabel?.font = MFStyler.fontB1()
}
//------------------------------------------------------
// MARK: - Methods
@ -61,10 +63,18 @@ open class CaretButton: MFCustomButton, MVMCoreUIMoleculeViewProtocol, MVMCoreUI
setTitleColor(disabledColor, for: .disabled)
if let rightCaretView = rightView as? CaretView {
rightCaretView.enabledColor = enabledColor
rightCaretView.disabledColor = disabledColor
rightCaretView.isEnabled = isEnabled
}
}
private func createCaretView() -> CaretView {
let caret = CaretView()
caret.lineWidth = 1.5
return caret
}
private func addCaretImageView() {
rightView?.removeFromSuperview()
@ -75,7 +85,7 @@ open class CaretButton: MFCustomButton, MVMCoreUIMoleculeViewProtocol, MVMCoreUI
let edgeInsets: UIEdgeInsets = contentEdgeInsets
contentEdgeInsets = UIEdgeInsets(top: edgeInsets.top, left: edgeInsets.left, bottom: edgeInsets.bottom, right: 4 + width)
let caretView: UIView = rightView ?? CaretView()
let caretView: UIView = rightView ?? createCaretView()
rightView = caretView
rightView?.translatesAutoresizingMaskIntoConstraints = false
addSubview(caretView)

View File

@ -31,7 +31,7 @@ import UIKit
view.translatesAutoresizingMaskIntoConstraints = false
addSubview(view)
view.backgroundColor = progressObject.progressColor.uiColor
view.widthAnchor.constraint(equalTo: widthAnchor, multiplier: progressObject.progress).isActive = true
view.widthAnchor.constraint(equalTo: widthAnchor, multiplier: progressObject.progress/100.0).isActive = true
view.leadingAnchor.constraint(equalTo: previous?.trailingAnchor ?? leadingAnchor).isActive = true
previous = view
NSLayoutConstraint.constraintPinSubview(view, pinTop: true, pinBottom: true, pinLeft: false, pinRight: false)