mild updates to caret
This commit is contained in:
parent
9079d6dcae
commit
1ac94059db
@ -103,8 +103,10 @@ open class CaretLink: Button, MVMCoreUIViewConstrainingProtocol {
|
||||
let width = CGFloat(rightViewWidth?.floatValue ?? CARET_VIEW_WIDTH)
|
||||
let height = CGFloat(rightViewHeight?.floatValue ?? CARET_VIEW_HEIGHT)
|
||||
|
||||
let edgeInsets: UIEdgeInsets = contentEdgeInsets
|
||||
contentEdgeInsets = UIEdgeInsets(top: edgeInsets.top, left: edgeInsets.left, bottom: edgeInsets.bottom, right: 4 + width)
|
||||
contentEdgeInsets = UIEdgeInsets(top: contentEdgeInsets.top,
|
||||
left: contentEdgeInsets.left,
|
||||
bottom: contentEdgeInsets.bottom,
|
||||
right: 4 + width)
|
||||
|
||||
let caretView: UIView = rightView ?? createCaretView()
|
||||
rightView = caretView
|
||||
@ -118,8 +120,8 @@ open class CaretLink: Button, MVMCoreUIViewConstrainingProtocol {
|
||||
caretLabelSpacing.isActive = true
|
||||
caretSpacingConstraint = caretLabelSpacing
|
||||
|
||||
NSLayoutConstraint(item: caretView, attribute: .centerY, relatedBy: .equal, toItem: self, attribute: .centerY, multiplier: 1.0, constant: 0).isActive = true
|
||||
NSLayoutConstraint(item: self, attribute: .right, relatedBy: .greaterThanOrEqual, toItem: caretView, attribute: .right, multiplier: 1.0, constant: 0).isActive = true
|
||||
caretView.centerYAnchor.constraint(equalTo: centerYAnchor).isActive = true
|
||||
trailingAnchor.constraint(greaterThanOrEqualTo: caretView.trailingAnchor).isActive = true
|
||||
caretView.topAnchor.constraint(greaterThanOrEqualTo: topAnchor).isActive = true
|
||||
bottomAnchor.constraint(greaterThanOrEqualTo: caretView.bottomAnchor).isActive = true
|
||||
contentHorizontalAlignment = .left
|
||||
@ -137,17 +139,21 @@ open class CaretLink: Button, MVMCoreUIViewConstrainingProtocol {
|
||||
// MARK: - Atomization
|
||||
//------------------------------------------------------
|
||||
public override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||
guard let caretLinkModel = model as? CaretLinkModel else { return }
|
||||
if let color = caretLinkModel.backgroundColor {
|
||||
|
||||
guard let model = model as? CaretLinkModel else { return }
|
||||
|
||||
if let color = model.backgroundColor {
|
||||
backgroundColor = color.uiColor
|
||||
}
|
||||
enabledColor = caretLinkModel.enabledColor.uiColor
|
||||
if let color = caretLinkModel.disabledColor {
|
||||
|
||||
enabledColor = model.enabledColor.uiColor
|
||||
if let color = model.disabledColor {
|
||||
disabledColor = color.uiColor
|
||||
}
|
||||
isEnabled = caretLinkModel.enabled
|
||||
set(with: caretLinkModel.action, delegateObject: delegateObject, additionalData: additionalData)
|
||||
setTitle(caretLinkModel.title, for: .normal)
|
||||
|
||||
isEnabled = model.enabled
|
||||
set(with: model.action, delegateObject: delegateObject, additionalData: additionalData)
|
||||
setTitle(model.title, for: .normal)
|
||||
}
|
||||
|
||||
public func needsToBeConstrained() -> Bool {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user